删除默认标题栏

时间:2012-03-05 03:11:53

标签: android android-layout

如何删除Android应用中默认的顶部标题栏?

enter image description here

灰色的Hello,Android吧?

9 个答案:

答案 0 :(得分:32)

删除标题栏非常简单Just,将android:theme属性添加到AndroidManifest.xml

<application android:theme="@android:style/Theme.NoTitleBar">

答案 1 :(得分:23)

<style name="MyTheme" parent="@android:style/Theme.NoTitleBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowBackground">@drawable/xyz</item>
</style>

答案 2 :(得分:5)

enter image description here

进入清单文件

单击底部的“应用程序”选项卡(如图所示)

输入@android:style/Theme.NoTitleBar(如图所示)

答案 3 :(得分:3)

试试这个:

requestWindowFeature(Window.FEATURE_NO_TITLE);

答案 4 :(得分:2)

为此,我宣称一种风格继承了我的一般风格。此样式禁用了默认的Android titleBar。

<style name="generalnotitle" parent="general">
    <item name="android:windowNoTitle">true</item>
</style>

创建一个新样式并在不同视图中添加此样式,或者以默认样式添加此代码以禁用所有窗口的titleBar!

答案 5 :(得分:1)

对于 Android Studio 2.2.2 ,2016

在[{1}}

上替换app/src/main/res/values/styles.xmlTheme.AppCompat.Light.DarkActionBar

示例:

Theme.AppCompat.NoActionBar

答案 6 :(得分:1)

使用默认的内置工具栏和您自己的自定义工具栏时会发生此问题。有两种方法。

1)导航到Values / style.xml&lt; ---基本应用程序主题样式到 - &gt;并更改您的父主题,如:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
  1. 另一种方法是在清单文件中为活动添加主题属性:

    android:theme =&#34; @ style / Theme.AppCompat.Light.NoActionBar&#34;

答案 7 :(得分:0)

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

在AndroidManifest.xml中我添加了代码=)

答案 8 :(得分:0)

还有几个主题没有标题栏。例如,Theme.AppCompat.Light.NoActionBar应用不带标题栏的相应主题

相关问题