android应用去掉标题栏的方法

本文介绍了四种有效的方法来移除Android应用中的标题栏:通过设置主题样式、在AndroidManifest.xml中指定活动属性、覆盖Activity中的请求特性以及使用AppCompatActivity隐藏ActionBar。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

android应用去掉标题栏的方法

这里写图片描述

这里写图片描述

去掉标题栏

1, <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.NoActionBar">
    <activity android:name=".SplashActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".activity.HomeActivity"></activity>
</application>

2,

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

3,

//隐藏标题栏
    //继承Activity的时候
    getWindow().requestFeature(Window.FEATURE_NO_TITLE);

4,

    //AppCompatActivity 继承的是v7包的时候
    getSupportActionBar().hide();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值