3 full screen methods and 3 ways to remove title bar in Android
- 2020-06-23 01:53:32
- OfStack
1. Remove the title bar
Type 1: One of the most common ways to get started
requestWindowFeature(Window.FEATURE_NO_TITLE);
// Remove the title bar and notice this sentence 1 Need to write in setContentView() Method, otherwise it will report an error
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, this removes the title bar from the entire application, and if you want to remove only one Activity title bar, you can add this property to the activity tag
Type 3: This is not often used in 1-like applications, which is to create a new style.xml file under the res/values directory
Such as:
<?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 an style, which is equivalent to a topic, and then defined in the AndroidManifest.xml file to remove the title bar
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/notitle">
2. Introduce the method of full screen
1 kind
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
2 kinds of
<android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
3 kinds of
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/fullscreem">