Android Learning Essay 28 (application summary)

Source: Internet
Author: User

    • How to remove the title bar

The first type : A method commonly used when getting started
Requestwindowfeature (window.feature_no_title);//Remove the 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

Note: This method does not work in the android4.1.1 Samsung i9300 phone tabhost, need to use the first method plus settheme together control.
SetTheme (Android. R.style.theme_black_notitlebar);
Requestwindowfeature (Window.feature_no_title);
Setcontentview (R.layout.api_tab_host);

The third type : custom styles, not commonly used in general applications, 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>
Equivalent to a topic and then defined in the Androidmanifest.xml file

<application android:icon= "@drawable/icon"
Android:label= "@string/app_name"
Android:theme= "@style/notitle" >
Achieve the effect of removing the title bar

The first is that we will see the title bar first and then disappear, because it is defined in the activity's OnCreate method.
The second is better than the first, and it will not happen this way.
The third kind of function can be separated, easy to maintain and expand, but more troublesome.

------------------------------------------------------

    • 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"

Android Learning Essay 28 (application summary)

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.