Android基础:去掉app界面的标题-Title

本文介绍了多种去除Android应用中标题栏的方法,包括通过代码、XML配置及主题设置等方式实现无标题栏显示。适用于不同版本的Activity基类。

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

去掉app的标题

方法一:

当继承自ActivityActionBarActivity时,在setContentView(...)方法前调用

requestWindowFeature(Window.FEATURE_NO_TITLE);

当继承自AppCompatActivity时,就无效了,必须采用方法五。

方法二:在activity节点下设置

theme:android:theme=”@android:style/Theme.Black.NoTitleBar” 黑色背景

android:theme=”@android:style/Theme.Light.NoTitleBar” 白色背景

“android:Theme.Holo.Light.NoActionBar”白底(包含alertDialog)

方法三:所有的value目录下的style文件修改为(不加@也可以)

style name=”AppBaseTheme” parent=”@android:style/Theme.Light.NoTitleBar”

方法四:application节点下的theme替换为:

android:theme=”@android:style/Theme.Black.NoTitleBar”
android:theme=”@android:style/Theme.Light.NoTitleBar”
android:theme=”@android:style/Theme.NoTitleBar”

方法四:

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    <item name="android:windowNoTitle">true</item>
</style>

方法五:

//隐藏标题栏
ActionBar actionBar = getSupportActionBar();
//ActionBar actionBar = getActionBar();
actionBar.hide();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值