隐藏的Andr​​oid操作栏的解决方案 [英] Hide Android Action Bar solution

查看:132
本文介绍了隐藏的Andr​​oid操作栏的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找解决隐藏的Andr​​oid操作栏。其中数万人发表和工作方式相同 - 动作栏隐藏它显示了第二个之后。不够好,所以我测试了和创建了自己的解决方案。这不是任何地方发表,但似乎对我来说很浅显。最重要的是 - 行动酒吧完全不能被视为

I've been looking for the solution to hide Android Action Bar. Tens of them are published and work the same way - Action Bar is hidden only after it's shown for the second. Not good enough, so I tested more and created my own solution. It was not published anywhere, but seems for me very simple and obvious. The most important is - Action Bar can't be seen at all.

我的问题是 - 有什么错呢? )为什么Android的恐龙避免这样的事情?

My question is - what's wrong with it ? ) Why did Android dinosaurs avoid something like that ?

解决隐藏的Andr​​oid操作栏:

Solution to hide Android Action Bar :

在清单

 android:theme="@style/CustomActionBarTheme"

在的themes.xml

in themes.xml

<style name="CustomActionBarTheme"
       parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="android:actionBarStyle">@style/MyActionBar</item>

    <!-- Support library compatibility -->
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

<!-- ActionBar styles -->
<style name="MyActionBar"
    parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
    <item name="android:layout_marginBottom">-50dp</item>
</style>

正如你可以看到我只使用负marginBottom。

As you can see I just use negative marginBottom.

推荐答案

您应该只使用 Theme.AppCompat.Light.NoActionBar - 它完全消除了操作栏按它的名字。

You should just use Theme.AppCompat.Light.NoActionBar - it completely removes the action bar as per its name.

这篇关于隐藏的Andr​​oid操作栏的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆