Full screen and remove title bar in Android

Source: Internet
Author: User

Full screen and remove title bar in Android

the method of removing the title bar
The First: a method that is often used when getting started
requestwindowfeature (window.feature_no_title); // Remove title bar
Note This sentence must be written in front of the Setcontentview () method, or it will be an error
the second type: defined in the Androidmanifest.xml file
<Application Android:icon="@drawable/icon"
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


Third: 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>
<stylename= "notitle">
<Itemname= "Android:windownotitle">true</Item>
</style> 
</Resources>

in this way, we customize a style, which is equivalent to a topic, and then defined in the Androidmanifest.xml file, The effect of removing the title bar can also be achieved


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



Summary of three ways to remove the title bar

the first kind, Sometimes we see that the title bar first appears, and then disappears, because we're just defining it in the OnCreate method of the activity.

the second kind, It's better than the first one, and it doesn't happen that way.

The Third Kind, personal feel is best, so the function is separated, easy to maintain and expand


"How to introduce full-screen"

First Kind

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


The second Kind

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


Third Kind

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

Full screen and remove 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.