Hi Android Community,

I want to change the background color of my overflow menu item when cliked, 
but it doesn't work.
My xml style file is like this:


<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="colorControlHighlight">@color/cardViewColor</item>
    <item name="actionOverflowButtonStyle">@style/overflowButtonStyle</item>
    <item 
name="actionBarItemBackground">@drawable/background_action_item_toolbar</item>
    <item 
name="popupMenuStyle">@style/background_action_menu_overflow_textcolor</item>
</style>


and my "background_action_menu_overflow_textcolor" is like this:

<style name="background_action_menu_overflow_textcolor" 
parent="Widget.AppCompat.Light.PopupMenu.Overflow">
    
    <item 
name="android:popupBackground">@drawable/background_action_menu_overflow_textcolor</item>
</style>



Finally, my drawable "background_action_menu_overflow_textcolor" is like 
this:


<selector xmlns:android="http://schemas.android.com/apk/res/android";>

    <item android:drawable="@color/cardViewColor" 
          android:state_pressed="true"
          android:state_focused="true"/>

    <item android:drawable="@android:color/white"/>

</selector>


Thanks a lot for your help,
Yass.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/23a3355a-0d4c-4cd7-aac3-f2856c7736af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to