Now I firmly believe that writing a technical blog is of great help to myself. writing a blog gives me a chance to learn and think.
There are three methods to remove the title bar in Android, which also have their own characteristics.
1. Implement in code
This. requestwindowfeature (window. feature_no_title); // remove the title bar.
Remember: This code should be written before setcontentview.
2. Implement in the configuration file (manifest. XML)
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
In this way, you can set the entire application to a non-title bar. If you only need to set a non-title bar in an activity, you only need to write the third line of code 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>
Then you can reference the manifest. xml file. This method is a little more troublesome.
<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/notitle">
In fact, we can see that the second method and the third method are essentially the same, but the second method calls the style defined by the system. XML file, while the third method is to define the style in your own application. XML, and then call it by yourself. In fact, the truth is the same. The third method is more fulfilling.