How Android apps get rid of the title bar

Source: Internet
Author: User

1. Implement in Code

This.requestwindowfeature (window.feature_no_title);//Remove the title bar, this refers to the current activity

This code must be preceded by Setcontentview ().

 This . Requestwindowfeature (Window.feature_no_title); Setcontentview (r.layout.activity_main);
View Code

2. Implementation in the manifest file

<application android:icon= "@drawable/icon"         android:label= "@string/app_name"         android: Theme= "@android: Style/theme.notitlebar" >
View Code

This is set to the entire app is no title bar, if you need to be in an activity set to a untitled bar form, just put the above android:theme="@android: Style/theme.notitlebar" Write it into one activity.

3. Defined 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

And then reference it in the manifest file.

<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 the third method are essentially the same, and the third one will be taller.

How Android apps get rid of the title bar

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.