Android removes method summaries from the status bar

  • 2020-12-20 03:45:56
  • OfStack

In real application development, we sometimes need to set Activity to full screen. In general, there are two ways to set Activity to full screen:

One, by setting it up in your code,

Its 2, through manifest configuration file to set the full screen.

Its 1: Set before setContentView in code onCreate (as follows)


view plaincopy to clipboardprint?
public void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
// Cancel the title  
requestWindowFeature(Window.FEATURE_NO_TITLE); 
// Cancel the status bar 
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
WindowManager.LayoutParams.FLAG_FULLSCREEN); 
setContentView(R.layout.main); 
}

However, it is important to note that in the code setting, the headers and the full screen should be placed in front of the setContentView(R.layout.main) code. Otherwise, you'll get an error.

Its 2: Set in the manifest configuration file

The first method

Create an ES27en.xml file in the res/values directory (for putting styles)


<?xml version="1.0" encoding="utf-8"?> 
<resources> 
<!-- name  is Style The name of the, parent  Inherit that parent class style  --> 
<style name="theme_fullScreen" parent="android:Theme.Black"> 
<item name="android:windowNoTitle">true</item> <!--  Set no title  --> 
<item name="android:windowFullscreen">?android:windowNoTitle</item> <!--  Whether to fill the slow screen, reference android:windowNoTitle  The value of the  ?android:windowNoTitle Depending on the android:windowNoTitle The value of the -->
</style> 
</resources>

2. < activity android:name=".login.LoginActivity" android:theme="@style/theme_fullScreen"/ >

The second method


<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.andyidea" 
android:versionCode="1" 
android:versionName="1.0"> 
<uses-sdk android:minSdkVersion="8" /> 
<application android:icon="@drawable/icon" android:label="@string/app_name"> 
<activity android:name=".login.LoginActivity" 
android:theme="@android :style/Theme.NoTitleBar.Fullscreen" 
android:label="@string/app_name"> 
<intent-filter> 
<action android:name="android.intent.action.MAIN" /> 
<category android:name="android.intent.category.LAUNCHER" /> 
</intent-filter> 
</activity> 
</application> 
</manifest> 

Just go to the program title bar to set the entire application no title

Type 3: This is not commonly used in 1-like applications. It is to create a new style.xml file under the res/values directory. For example:


<?xml version="1.0" encoding="UTF-8" ?> <resources> <style name="theme_notitle"> <item name="android:windowNoTitle">true</item> </style> </resources>

In this way, we have customized an style, which is equivalent to a topic, and then defined in the AndroidManifest.xml file


<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/theme_notitle">

This will also remove the title bar

Here are 3 ways android can get rid of the status bar, and I hope this article will help you.


Related articles: