我在下面的官方开发人员指南叠加动作条。
I was following official developer's guide to overlay actionbar.
我的 style.xml
是如下:
<!-- Base application theme. -->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="actionBarStyle">@style/CustomActionBarTheme</item>
</style>
<style name="CustomActionBarTheme"
parent="@android:style/Theme.Holo">
<item name="android:windowActionBarOverlay">true</item>
</style>
我的midSdkVersion为14,预计产量类似于官方指南:
My midSdkVersion is 14 and expected output is similar to that on official guide:.
相反,在我的情况下,输出是:
instead, in my case the output is:
(我已经设置背景颜色为活动......但它不是覆盖行动吧。)
(I have set background color to activity...but it isn't overlaying action bar.)
请帮我如果有什么我做的是错的。
Please help me if anything I'm doing is wrong.
我想这样的类似行动酒吧airnb和许多其他应用程序。谁能给我完整的答案了呢?
I wanted similar action bar like this in airnb and many other apps. Can anyone give me complete answer for this?
我看到你的code一些误解:
I see some misunderstandings in your code:
windowActionBarOverlay
应该在你的主题指定不是在你的动作条
的风格。
没有理由使用河洛
与支持的主题。这只是伤了你的保障。
windowActionBarOverlay
should be specified on your theme not on your ActionBar
's style.
No reason to use a Holo
with a support theme. This just breaks your supportability.
试试这个:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:windowActionBarOverlay">true</item>
<!--For compatibility-->
<item name="actionBarStyle">@style/MyActionBar</item>
<item name="windowActionBarOverlay">true</item>
</style>
<color name="transparent_black">#80000000</color>
<style name="MyActionBar" parent="Widget.AppCompat.ActionBar.Solid">
<item name="android:background">@color/transparent_black</item>
<!--For compatibility-->
<item name="background">@color/transparent_black</item>
</style>