How to remove the title bar (using the request window feature)( Window.FEATURE_ NO_ Title); why it fails)

The method to remove the title bar (use requestWindowFeature(window.feature_no_title); Why does it fail?
Use RequestWindowFeature (window.feature_no_title) to hide the cause of the failure of the title bar, possibly because the activity inherits from AppCompatActivity. The use method is described in detail below:
A, if you create the activity inherited activity:
the first one: introduction to often use a method:


//remove the title bar of note that this sentence must be written in the book of the setContentView () method, in front of or complains
the second: in the AndroidManifest. Defined in the XML file

<application android:theme="@android:style/Theme.NoTitleBar">

Wrote, then the application will remove the title bar, if just want to get rid of a certain Activity of the title bar, you can add this property to the Activity inside the tag
the third: this is not commonly used in general application, is in the res/values below to create a new style. The XML file
code is as follows:
duplicate code

<?xml version="1.0" encoding="UTF-8" ?>
    <style name="notitle">
        <item name="android:windowNoTitle">

Copying code
in this way, we can customize a style, is equivalent to a topic, and then in the AndroidManifest. Defined in the XML file, also can achieve the effect of removing the title bar
code is as follows:



//Remove the title bar Note that this sentence must be written after the setContentView() method

Second: You can do the following in AndroidManifest.xml, so there is no title bar


Read More: