我有一个自定义的主题与父母@android:风格/ Theme.Holo.Light.DarkActionBar 我想将下拉菜单更改为白色版本(请参阅图像)黑色的操作栏与Holo Light的白色下拉菜单
我查了一些例子,但他们没有为我工作,是否有可能只是覆盖从LightActionBar的轻型版本的下拉菜单?
(我不使用大侦探动作条)
我有一个自定义的主题与父母@android:风格/ Theme.Holo.Light.DarkActionBar 我想将下拉菜单更改为白色版本(请参阅图像)黑色的操作栏与Holo Light的白色下拉菜单
我查了一些例子,但他们没有为我工作,是否有可能只是覆盖从LightActionBar的轻型版本的下拉菜单?
(我不使用大侦探动作条)
这为我工作。希望它能帮助:
<style name="YOUR_DARK_AB_THEME">
<item name="android:actionBarWidgetTheme">@style/YourActionBarWidget</item>
</style>
<!-- This helps the PopupMenu stick with Light theme while the ActionBar is in Dark theme -->
<style name="YourActionBarWidget"
parent="android:Theme.Holo.Light">
<item name="android:popupMenuStyle">@android:style/Widget.Holo.Light.PopupMenu</item>
<item name="android:dropDownListViewStyle">@android:style/Widget.Holo.Light.ListView.DropDown</item>
</style>
完美地工作。 –
任何机会,只是在Light.DarkActionbar不起作用?我不断得到黑暗的下拉。 - 似乎没有默认的黑暗工作。也许是因为我使用的是AppCompat –
我使用AppCompat – Leon
使用动作条的同样情况下创建的弹出菜单
actionBar.getThemedContext()
所以,
动作条动作条=( (ActionBarActivity) getActivity())。getSupportActionBar();
PopupMenu popMenu = new PopupMenu(actionBar.getThemedContext(),anyView);
我倾向于只使用这个http://jgilfelt.github.io/android-actionbarstylegenerator/ – Broak
看看这个帖子,[http://stackoverflow.com/questions/16878662/how-to-set- android-popupmenu-to-white]的背景(http://stackoverflow.com/questions/16878662/how-to-set-the-background-of-android-popupmenu-to-white)我认为它是同一个问题。 – JoeyPhillips