ActionBar three-dot dropdown opens at the wrong place

蹲街弑〆低调 提交于 2019-12-11 03:49:07

问题


I've implemented an ActionBar with the com.android.support:appcompat-v7:22.1.1 library. Here you can see the code and my question:

ActionBar with appcompat library v7 (ava.lang.IllegalStateException: You need to use a Theme.AppCompat theme)

That works, but I have one last problem. After changing the ActionBar to the new library, the settings dropdown opens into the actionbar and not among it (see image) and the background of the settings dropdown is grey instead of white?

How can I solve that?


回答1:


Answering the first part of your question, the placement/location of the dropdown menu is supposed to be that way according to the Material Design guidelines, so that's not a bug.

Concerning the second part, to change the color of the dropdown menu to white, in styles.xml, add the following lines:

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:popupMenuStyle">@style/popupMenuStyle</item>
</style>

<style name="popupMenuStyle" parent="@android:style/Widget.PopupMenu">
<item name="android:popupBackground">#FFFFFF</item>
</style>

And in your AndroidManifest.xml, replace:

 android:theme="@style/Theme.AppCompat.Light.DarkActionBar">

with:

 android:theme="@style/AppTheme">


来源:https://stackoverflow.com/questions/30397155/actionbar-three-dot-dropdown-opens-at-the-wrong-place

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!