Remove the title bar from the Android app. Remove the title bar from the android app.
1. Implement in code
This. requestWindowFeature (Window. FEATURE_NO_TITLE); // remove the title bar. this indicates the current Activity.
This code must be added before setContentView.
This. requestWindowFeature (Window. FEATURE_NO_TITLE); setContentView (R. layout. activity_main );View Code
2. Implement in the configuration file
<Application android: icon = "@ drawable/icon" android: label = "@ string/app_name" android: theme = "@ android: style/Theme. NoTitleBar">View Code
In this way, the entire application has no title bar. If you need to set a form without a title bar in an Activity, you just need to set android: theme = "@ android: style/Theme above. noTitleBar "can be written to an Activity.
3. Define in the style. xml file
<? Xml version = "1.0" encoding = "UTF-8"?> <Resources> <style name = "notitle"> <item name = "android: windowNoTitle"> true </item> </style> </resources>View Code
Then reference
<Application android: icon = "@ drawable/icon" android: label = "@ string/app_name" android: theme = "@ style/notitle">View Code <application android: icon = "@ drawable/icon" android: label = "@ string/app_name" android: theme = "@ style/notitle">View Code
In fact, the second and third methods are essentially the same, and the third method will be larger.