How to set full screen in Android application

Generally, there are three ways to set the full screen display of Android applications

The first is code implementation
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Setting without Title requestWindowFeature(Window.FEATURE_NO_TITLE); //Setting the full screen of the application must be written before the setContentView method! ! ! Remember! getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main);





The second is to configure in the AndroidManifest, xml manifest configuration file and
add attributes to the nodes in the corresponding Activity: android:theme="@android:style/Theme.NoTitleBar.Fullscreen" to set an Activity to display in full screen. If it is set to android:theme="@android:style/Theme.NoTitleBar", it is just set to the untitled state.



            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

The third method is to customize the full-screen Theme
and define the theme in the style.xml file (if there is no style.xml, create it in the res/values ​​directory) and then directly add android:theme



to the Activity attribute that needs full-screen display in AndroidManifest.xml
= "@style/Theme.NoTitle_FullScree"

Guess you like

Origin blog.csdn.net/baiyifei2016/article/details/127052895
Recommended