没有ActionBar的Android Activity [英] Android Activity without ActionBar
问题描述
我的应用程序中有不同的活动
,而且我不想要操作栏
。我找不到如何禁用它。我试图找到一个属性将其应用于 main_activity.xml
但到目前为止我没有找到任何内容。请问有人能帮帮我吗?
I have different Activities
in my App and in all of them I do not want the Action Bar
. I cannot find how to disable it. I have tried to find an attribute to apply it to the main_activity.xml
but so far I did not find anything. Can somebody help me please?
推荐答案
哈哈,我刚才也被困在那一点上,所以我很高兴我可以帮你解决一个至少对我有用的解决方案:)
Haha, I have been stuck at that point a while ago as well, so I am glad I can help you out with a solution, that worked for me at least :)
你想要做的是在values / styles.xml中定义一个新样式吧看起来像这样
What you want to do is define a new style within values/styles.xml so it looks like this
<resources>
<style name = "AppTheme" parent = "android:Theme.Holo.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name = "NoActionBar" parent = "@android:style/Theme.Holo.Light">
<item name = "android:windowActionBar">false</item>
<item name = "android:windowNoTitle">true</item>
</style>
</resources>
只有NoActionBar风格才有意义。最后你必须在AndroidManifest.xml中设置为你的应用程序的主题,所以它看起来像这样
Only the NoActionBar style is intresting for you. At last you have to set is as your application's theme in the AndroidManifest.xml so it looks like this
<application
android:allowBackup = "true"
android:icon = "@drawable/ic_launcher"
android:label = "@string/app_name"
android:theme = "@style/NoActionBar" <!--This is the important line-->
>
<activity
[...]
我希望这有帮助,如果没有,请告诉我。
I hope this helps, if not, let me know.
这篇关于没有ActionBar的Android Activity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!