Android development removes the title bar. The third method is recommended.
Android: three methods to remove the title bar and full screen
First: a method that is often used when getting started
Add the following code to the onCreate function:
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 entire application will remove the title bar. 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 customize a 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/notitle">
Three methods to remove the title bar are summarized first. Sometimes we can see that the title bar appears first and then disappears, because we only define it in the oncreate method of activity, the second one is better than the first one, so it won't happen. The third one I personally feel the best. In this way, the functions are separated to facilitate maintenance and expansion.
How to remove title bar title from Android Development
It is actually very simple to remove the title bar from Android development. There are two methods: adding a title in the Code and adding a title in AndroidManifest. add in xml: 1. Implement in code: setContentView (R. layout. main) added before: requestWindowFeature (Window. FEATURE_NO_TITLE); the title bar is gone. 2. Implement in AndroidManifest. xml: Add the following configuration when registering an Activity. <Activity android: name = ". Activity"
How does Android cancel the default title bar content?
It is actually very simple to remove the title bar from Android development. There are two methods: add the title in the code, and add the title in AndroidManifest. xml:
1. Implementation in code:
Before setContentView (R. layout. main) in this method, add:
RequestWindowFeature (Window. FEATURE_NO_TITLE); the title bar is gone.
2. Implementation in AndroidManifest. xml:
You can add the following configuration when registering an Activity.
<Activity android: name = ". Activity"
Android: theme = "@ android: style/Theme. NoTitleBar">
</Activity>