AppCompat custom theme does not change overflow icon on older devices

I recently decided to change the Action Overflow Icon in my application. I have earned on Lollipop devices, but it does not work on my Ice Cream Sandwich and Kitkat device. Note. On both devices on which it does not work, the overflow icon has 3 rounded dots, so the theme changes it to the Material version ... just not my version.

My problem is that I cannot get this to work on older devices, but it works on Lollipop.

I used to have to create separate themes for each version, but now this is not necessary. Only one topic is recommended.

the code

 <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:actionOverflowButtonStyle">@style/OverflowMenuButton</item> <item name="colorPrimary">@color/primary</item> <item name="colorPrimaryDark">@color/primary_dark</item> <!--<item name="colorPrimaryLight">@color/primary_light</item>--> <item name="colorAccent">@color/accent</item> <item name="android:textColorPrimaryInverse">@color/primary_text_light</item> <item name="android:textColorPrimary">@color/primary_text</item> <item name="android:textColorSecondary">@color/secondary_text</item> <!--<item name="icons">@color/icons</item>--> <item name="divider">@color/divider</item> </style> <style name="OverflowMenuButton" parent="@style/Widget.AppCompat.ActionButton.Overflow"> <item name="android:src">@drawable/ic_star_rate_white_18dp</item> </style> </resources> 

Correct icon

enter image description here

Invalid Icon

enter image description here

+1
android icons android-theme android-menu
Aug 20 '15 at 1:12
source share
1 answer

You are using android:actionOverflowButtonStyle , which is the right approach to replace the frame overflow button, available only on Lollipop and higher devices.

However, AppCompat has its own actionOverflowButtonStyle attribute , which works on all API 7+ devices - you should use this instead of android:actionOverflowButtonStyle :

 <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="actionOverflowButtonStyle">@style/OverflowMenuButton</item> ... </style> 
+3
Aug 20 '15 at 1:28
source share



All Articles