Full Screen in Android and remove the title bar, android title bar
Full Screen in Android and remove the title bar
How to remove the title bar
First: a method that is frequently used when getting started
RequestWindowFeature (Window. FEATURE_NO_TITLE); // remove the title bar.
Note that this sentence must be written before the setContentView () method. Otherwise, an error will be reported.
Type 2: defined in the AndroidManifest. xml file
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
As you can see, the title bar will be removed for the entire application. If you only want to remove the title bar of an Activity, you can add this attribute to the activity tag.
Third: This is not commonly used in general applications. It is to create a style. xml file under the res/values directory.
For example:
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="notitle">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
In this way, we have customized a style, which is equivalent to a topic and defined in the AndroidManifest. xml file. This can also remove the title bar.
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/notitle">
Summary of three methods for removing the title bar
First, sometimes we will see that the title bar appears first and then disappears, because we only define
The second one is better than the first one, so this will not happen.
Third, I personally think it is best to separate functions to facilitate maintenance and expansion.
Introduction to full screen
First
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Second
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
Third
application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/fullscreem"