android中的样式溢出菜单

时间:2016-02-19 07:44:42

标签: android

   <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:popupMenuStyle">@style/MyPopupMenu</item>
   </style>

当我试图添加

   <style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
   <item name="android:popupMenuStyle">@style/PopupMenu</item>
   </style>
  <style name="PopupMenu"parent="android:Widget.Holo.Light.ListPopupWindow">
    <item name="android:popupBackground">#888888</item>
  </style>

父级不匹配背景未改变

这是我试过的代码

   <style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
   <item name="android:popupMenuStyle">@style/PopupMenu</item>
   </style>
  <style name="PopupMenu"  parent="Theme.AppCompat.Light.ListPopupWindow**">
    <item name="android:popupBackground">#888888</item>
   </style>

1 个答案:

答案 0 :(得分:0)

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

<style name="PopupMenu" parent="@android:style/Widget.PopupMenu">
<item name="android:popupBackground">@android:color/white</item>
</style>

的manifest.xml

<application
android:allowBackup="true"
android:theme="@style/AppTheme" >
.............
</application>

尝试这样的事情。希望它有所帮助。