我在做我的应用程序准备为Android 5.0,我使用的是最新的兼容性库,这里是我的风格的样子。
I'm making my app ready for Android 5.0, I'm using the latest compatibility library, here is what my style looks like.
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/theme_accent</item>
<item name="colorAccent">@color/theme_accent_secondary</item>
</style>
<style name="AppThemeDark" parent="Theme.AppCompat">
<item name="colorPrimary">@color/theme_accent</item>
<item name="colorAccent">@color/theme_accent_secondary</item>
</style>
</resources>
(该动作条的颜色被设置编程。)
(The ActionBar color is being set programmatically.)
现在,我想的溢/弹出菜单中有黑暗的背景喜欢它曾在全息实现,但我不能让它的工作,这里是什么样子:
Now, I want the overflow/popup menu to have the dark background like it had in the holo implementation, but I can't get it to work, here is what it looks like:
我已经尝试设置 popupMenuStyle
,但没有奏效。
I have tried setting the popupMenuStyle
but it didn't work.
我怎样才能让弹出式菜单中较暗的?
How can I make the popup menu darker?
解决了使用这种风格我的问题:
Solved my problem by using this style:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/theme_accent</item>
<item name="colorAccent">@color/theme_accent_secondary</item>
<item name="actionBarStyle">@style/AbStyle</item>
<item name="actionModeBackground">@color/actionmode_bg</item>
</style>
<style name="AbStyle" parent="Widget.AppCompat.Toolbar">
<item name="elevation">2dp</item>
<item name="displayOptions">homeAsUp|showTitle</item>
<!--showHome-->
</style>
<style name="AppThemeDark" parent="Theme.AppCompat">
<item name="colorAccent">@color/theme_accent_secondary</item>
<item name="actionBarStyle">@style/AbStyle</item>
</style>
我不得不使用Widget.AppCompat.Toolbar作为家长actionBarStyle
I had to use Widget.AppCompat.Toolbar as the parent actionBarStyle