Three ways to get rid of the title bar in Android apps

Source: Internet
Author: User

There are three ways to get rid of the title bar in Android, and they have their own characteristics.

1. Implement in Code


Remember: This code should be written in front of Setcontentview ().

2. Implemented in the manifest file (manifest.xml)

<application android:icon= "@drawable/icon"          android:label= "@string/app_name"          


<span style= "FONT-FAMILY:VERDANA;FONT-SIZE:18PX;" ><application android:icon= "@drawable/icon"         android:label= "@string/app_name"         android:theme= "@ Android:style/theme.notitlebar "></span>
This can be used to set the entire application to no title bar, if only one activity is set to a untitled bar form, as long as the above the third line of code written to a certain activity inside it.

3. Defined in the Style.xml file

<?xmlversion= "1.0" encoding= "UTF-8"?> <resources>    <style name= "Notitle" >         <item name= " Android:windownotitle ">true</item>    </style>  

<span style= "FONT-FAMILY:VERDANA;FONT-SIZE:18PX;" ><?xml version= "1.0" encoding= "UTF-8"?><resources>    <style name= "Notitle" >        <item Name= "Android:windownotitle" >true</item>    </style> </resources></span>
then the face manifest.xml in the reference, this method is slightly more troublesome.

<applicationandroid:icon= "@drawable/icon"          android:label= "@string/app_name"         

<span style= "FONT-FAMILY:VERDANA;FONT-SIZE:18PX;" ><application android:icon= "@drawable/icon"         android:label= "@string/app_name"         android:theme= "@ Style/notitle "></span>

In fact, it can be seen that the second method is essentially the same as the third method, But the second method calls the system-defined Style.xml file, and the third method is to define the Style.xml in its own application, and then call it by itself, in fact, the truth is the same, the third way to do more sense of accomplishment.

Three ways to get rid of the title bar in Android apps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.