Android学习——去除Android APP的界面标题——Title

去除APP中的界面标题

方法一:在activity节点下设置

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

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

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

方法二:在application节点中设置应用主题为无标题样式

修改位置:AndroidMainfest.xml 中的application节点

android:theme="@style/Theme.AppCompat.Light.NoActionBar"

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

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

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

方法三:给不需要标题的Activity设置

修改位置:AndroidMainfest.xml 中的application节点下的各个Activity节点

给不需要标题的Activity设置属性(每一Activity的设置只能保证当前activity无标题,不能改变其他activity)

android:theme="@style/Theme.AppCompat.Light.NoActionBar"

方法四:给APP应用的主题样式设置成无标题

在value/style或value/themes 中设置

style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"

方法五:编码实现

//隐藏标题栏

ActionBar actionBar = getSupportActionBar();

//ActionBar actionBar = getActionBar();

actionBar.hide();

  

posted @ 2022-04-27 23:05  zzzLS  阅读(264)  评论(0编辑  收藏  举报