In Android development, each activity will default with a title bar to display the program name, sometimes in order to enlarge the screen display area need to remove the title bar, remove the title bar on the screen has 3 methods,
The first method is to remove the title bar from the code
Add the following code to the activity's OnCreate:
Java code
- This.requestwindowfeature (Window.feature_no_title);
But with this approach, the title bar will still appear when the activity is about to be displayed, and then removed, and the user experience is not good.
The second method is to use the style configuration file , as follows:
1. Create an XML file under the Res/values folder named Mainstyle.xml, which reads as follows:
Java code
- <?xml version="1.0" encoding="Utf-8"?>
- <resources>
- <style name="Notitle" parent="Android:theme" >
- <item name="Android:windownotitle" >true</item>
- </style>
- </resources>
2. Then add a style attribute to the activities node in Androidmanifest.xml that needs to remove the title bar, with the following code:
Java code
- <activity android:name=". View. Autotaskdemo "android:label=" @string/app_name "
- android:configchanges= "keyboardhidden|orientation|locale" android:theme="@style/notitle" >
The third method is to modify directly in the Androidmanifest.xml,
Add a style attribute to the activities node that needs to remove the title bar, and the code is as follows:
Java code
- <activity android:name=". View. Settingactivity "
- android:configchanges= "keyboardhidden|orientation" Android:theme="@android: Style/theme.notitlebar"/>
can also be modified on the application node of the Androidmanifest.xml file, valid for all activity, the code is as follows:
Java code
- <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme= "@ Android:style/theme.notitlebar ">
Get rid of the title bar on Android screen