工具栏中子菜单项的按下颜色

时间:2016-02-05 22:46:32

标签: android

如何在工具栏的子菜单弹出项目中更改按下状态的背景颜色?

这是我的代码: 的 styles.xml

<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

</style>

<style name="PopupMenu" parent="@style/ThemeOverlay.AppCompat.Light">
    <item name="android:selectableItemBackground">@android:color/holo_green_light</item>
</style> </resources>

toolbar.xml

<android.support.v7.widget.Toolbar
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/toolbar"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:minHeight="?attr/actionBarSize"
  android:background="@color/colorPrimaryDark"
  app:popupTheme="@style/PopupMenu"
  app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

screenshot

0 个答案:

没有答案