Full screen or cancel title bar in Android

Source: Internet
Author: User

first introduce the method of removing the title bar: The first type:Also generally used when the introduction of a method Requestwindowfeature (window.feature_no_title);//Remove the title bar note This must be written in front of the Setcontentview () method, or it will be an error The second type:Define <application android:icon= "@drawable/icon" in the Androidmanifest.xml file
Android:label= "@string/app_name"
Android:theme = "@android: Style/theme.notitlebar">

As can be seen, the entire application will be removed from the title bar, if you want to remove the title bar of an activity, you can add this attribute to the activity tag

The third type:This is not commonly used in general applications, is to create a new Style.xml file under the Res/values directory

For example:

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

In this way, we customize a style, which is the equivalent of a topic, and then define it in the Androidmanifest.xml file.

<application android:icon= "@drawable/icon"
Android:label= "@string/app_name"
Android:theme = "@style/notitle">

This can also be achieved by removing the title bar effect

Summary of three ways to remove the title bar

First, sometimes we will see that the title bar will appear first, and then disappear, because we are only defined in the activity of the OnCreate method, the second relative to the first is better, do not appear this situation, the third I personally feel the best, so that the function is separate, easy to maintain and expand

to introduce the full-screen method:

First Kind

GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

The second Kind

Android:theme= "@android: Style/theme.notitlebar.fullscreen"

Third Kind

Application android:icon= "@drawable/icon"
Android:label= "@string/app_name"
Android:theme= "@style/fullscreem"

The third type of customization is stronger, and it is recommended

Reference: http://www.cnblogs.com/and_he/archive/2011/06/01/2067106.html

Full screen or cancel title bar in Android

Related Article

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.