Android 仅为一个活动隐藏操作栏标题
如果我为整个应用程序应用主题,它将成功隐藏ActionBar标题:Android 仅为一个活动隐藏操作栏标题,android,android-actionbar,android-styles,Android,Android Actionbar,Android Styles,如果我为整个应用程序应用主题,它将成功隐藏ActionBar标题: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="AppTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:actionBarStyle">@style/ActionBarStyle</item> &
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
</style>
<style name="ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions">showHome|useLogo</item>
</style>
</resources>
@风格/动作条风格
showHome | useLogo
在清单中分配:
<application
android:name="myapp"
android:allowBackup="true"
android:icon="@drawable/action_bar_icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
我需要动作栏标题隐藏在一个活动中
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
...other things...
</style>
<style name="MainActivityTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
</style>
<style name="ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions">showHome|useLogo</item>
</style>
</resources>
…其他事情。。。
@风格/动作条风格
showHome | useLogo
为一项活动明确设置此主题:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:id="@+id/mainLayout"
android:orientation="vertical"
android:theme="@style/MainActivityTheme">
它仍然在
MainActivity
ActionBar
中显示标题。我知道如何在java中隐藏标题,我需要知道在XML中我做错了什么。在清单中设置活动的主题
<activity
android:name=".MyActivity"
android:theme="@style/MainActivityTheme" />
在清单中设置活动的主题
<activity
android:name=".MyActivity"
android:theme="@style/MainActivityTheme" />
您可能希望创建一个子主题,隐藏操作栏:
<style name="AppTheme.NoActionBar">
<item name="android:windowActionBar">false</item>
</style>
此外,如果您正在使用AppCompat库,您可能希望向子主题添加一个无命名空间的版本
<item name="windowActionBar">false</item>
false
您可能希望创建一个子主题,隐藏操作栏:
<style name="AppTheme.NoActionBar">
<item name="android:windowActionBar">false</item>
</style>
此外,如果您正在使用AppCompat库,您可能希望向子主题添加一个无命名空间的版本
<item name="windowActionBar">false</item>
false
如果要删除操作栏标题
,只需从清单
文件中的
标记中删除标签
属性即可
比如,
<activity
android:name=".YourActivityName"
android:label="@string/title" />
在移除之后
<activity
android:name=".YourActivityName" />
完成了 如果要删除
操作栏标题
,只需从清单
文件中的
标记中删除标签
属性即可
比如,
<activity
android:name=".YourActivityName"
android:label="@string/title" />
在移除之后
<activity
android:name=".YourActivityName" />
完成了 你只想隐藏actionbar标题或actionbar?请参阅文章以获得想法。你可以通过简单的方法来实现这一点。在您的
onCreate
中,执行此getActionBar.hide()代码>你只想隐藏actionbar标题或actionbar?请参阅文章以获得想法你可以通过简单的方法来实现这一点。在您的onCreate
中,执行此getActionBar.hide()代码>