Hide the title of an activity and the title of an activity.

Source: Internet
Author: User

Hide the title of an activity and the title of an activity.
1. Remove android: label = "@ string/app_name" directly"

        <activity            android:name=".SplashActivity"            android:label="@string/app_name"             >            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>

Remove
 android:label="@string/app_name"

No title!


2. Add requestWindowFeature (Window. FEATURE_NO_TITLE) to onCreate or the above activity, but add the following line of code without displaying the title.
Protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); // hide the title requestWindowFeature (Window. FEATURE_NO_TITLE); setContentView (R. layout. activity_splash );
}

3. Add android: theme = "@ android: style/Theme. Black. NoTitleBar" to the activity corresponding to the configuration file"
        <activity            android:name=".SplashActivity"            android:label="@string/app_name"            android:theme="@android:style/Theme.Black.NoTitleBar"             >            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>
Note: When the dialog is displayed, a black page is displayed! You can also add an item in AppTheme.
<item name="windowNoTitle">true</item>
It can also be applied.


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.