Android Activity full screen display method

  • 2020-06-07 05:19:01
  • OfStack

This paper describes Activity in detail under Android Activity full screen display method. Share to everybody for everybody reference. The specific methods are as follows:

Method 1:

Using the xml method, in the AndroidManifest.xml file of the project, add attributes to the Activity element that requires a full screen:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

In this way, the full screen display of Activity can be achieved. If the title bar is just not needed, i.e. the built-in taskbar of the system should be kept, then use:

android:theme="@android:style/Theme.NoTitleBar"

The advantage is that you don't have to change it in your code.

Method 2:

Make changes using code

No title bar:

requestWindowFeature(Window.FEATURE_NO_TITLE);

Full screen:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

Using the code can dynamically make the Activity to carry out full screen, such as the realization of double-click after the screen to carry out full screen.

Hopefully, this article has helped you with your Android programming.


Related articles: