Android Development removed title bar

Source: Internet
Author: User

There are 3 ways to remove the title bar on the screen:

1.java Code implementation:

1 @Override 2 publicvoid onCreate (Bundle savedinstancestate) {3Super. OnCreate (savedinstancestate ); 4 5 requestwindowfeature (window.feature_no_title); 6 7        Setcontentview (r.layout.main); 8 // ... 9 }

2. Customizing the style configuration file

In the \res\values inside the Style.xml add:

1 <?xmlversion= "1.0" encoding= "Utf-8 "?>2 <Resources>3 <StyleName= "Notitle"Parent= "Android:theme">4 <ItemName= "Android:windownotitle">True</Item>5 </style>6 </Resources>

Then in the Androidmanifest.xml file, add android:theme= "@style/notitle to the node that needs to remove the activity from the title bar as follows:

1 < Activityandroid:name =". Mainactivity "2android:configchanges=" Orientation|keyboardhidden "3  Android:theme= "@style/notitle"/>

3. Make changes directly in the Androidmanifest.xml

It turns out that we can simply call the system without having to customize the style configuration:

1 < Activityandroid:name =". Mainactivity "2android:configchanges=" Orientation|keyboardhidden "3  Android:theme= "@android: Style/theme.notitlebar"/>

If we want to set the entire application to remove the title bar, then set the application:

1 < Applicationandroid:icon = "@drawable/lightbulb" Android:label = "@string/app_name" 2 Android:theme = "@android: Style/theme.notitlebar" >

Android Development removed 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.