问题
Recently I decided to change the Action Overflow Icon
on my app. I got it working on Lollipop devices, but it isn't working on my Ice Cream Sandwich and Kitkat device. Note: on both the devices that it does not work on, the action overflow icon has 3 rounded dots, so the theme is changing it to the Material version....just not my version.
My issue is that I cannot get this to work on older devices, but it works on Lollipop.
Before, I would have had to create separate themes for each version, but now that is not needed. Only one theme is recommended.
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

Incorrect icon

回答1:
You are using android:actionOverflowButtonStyle
, which is the correct approach for replacing the framework overflow button, only available on Lollipop and higher devices.
However, AppCompat has its own actionOverflowButtonStyle attribute which works on all API 7+ devices - you should use that in place of android:actionOverflowButtonStyle
:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="actionOverflowButtonStyle">@style/OverflowMenuButton</item>
...
</style>
来源:https://stackoverflow.com/questions/32108027/custom-appcompat-theme-not-changing-overflow-icon-on-older-devices