Every time you create a project, you probably choose Empty Activity, but this theme comes with its own title bar, and sometimes you need to develop your own designDesign your app’s exclusive title barThat’s when we need itRemove the default title bar.
Method one:
Open the androidmanifest.xml file and change the theme under the Application TAB to
android:theme="@style/Theme.AppCompat.NoActionBar"
Copy the code
This method uses Android’s built-in theme to remove the title bar
Method 2 :(highly recommended)
Instead of modifying the theme under the Application TAB, open the corresponding theme file and write to it
For example, if the name attribute of my theme file is theme. Android_project, the corresponding file location is theme.xml in values
Click theme. XML to open and add code to the style TAB
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
Copy the code
This method uses its own theme to remove the title bar, and you can also set other custom styles