Android programming interface to achieve full screen display of 2 methods

  • 2021-01-19 22:26:21
  • OfStack

This paper describes the Android programming interface to achieve full screen display method. To share with you for your reference, as follows:

In the development of android applications, we will encounter a set of interfaces to display the full screen format, there are two ways to achieve this. Its 1 is implemented in Java code, and its 2 is implemented in configuration files.

1. Set it in Java code


super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); // There is no title
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Full screen 
setContentView(R.layout.main);

2. Modify in Manifest file

Added in Activity, which is launched by default

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


<activity android:name=".MainActivity"
     android:label="@string/app_name"
     android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
     >
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>

For more information on Android development, please check out the Android Development Introduction and Advanced Course.

I hope this article is helpful to Android program design.


Related articles: