I have just update android support library from com.android.support:appcompat-v7:25.3.1
to com.android.support:appcompat-v7:26.0.1
. It changed the appearance of action mode icons. Now they are half-visible/pressed as shown in the picture.
Is it a bug in the support library or I am doing something wrong?
Here is how I set the icons of action mode.
@Override
public boolean onCreateActionMode(android.view.ActionMode mode, Menu menu) {
menu.add("Delete").setIcon(R.drawable.ic_action_discard);
menu.add("Copy").setIcon(R.drawable.ic_action_copy);
return true;
}
Update
I have verified this is a bug in android support library.
here is the link https://issuetracker.google.com/issues/64207386
Update
Google updated the new release.
From Recent Support Library Revisions
page.
Bug fixes
Menu icons are flattened on Support Library 26.0.0
An adaptive icon, or AdaptiveIconDrawable , can display differently depending on individual device capabilities and user theming. Adaptive icons are primarily used by the launcher on the homescreen, but can also be used in shortcuts, the Settings app, sharing dialogs, and the overview screen.
Android O icons represent your app on a device's Home and All Apps screens.
Chances are there that it's becuase of less height than the icons require.
You can try this.
Add these two lines in values -> styles.xml -> Apptheme (style name must be only AppTheme
).
<item name="android:actionButtonStyle">@style/actionButtonSize</item>
<item name="actionButtonStyle">@style/actionButtonSize</item>
And copy this style (in same styles.xml).
<style name="actionButtonSize" parent="Widget.AppCompat.ActionButton">
<item name="android:minWidth">30dp</item>
<item name="android:maxWidth">48dp</item>
<item name="android:width">38dp</item>
<item name="android:minHeight">30dp</item>
<item name="android:maxHeight">48dp</item>
<item name="android:height">38dp</item>
</style>
Also, sizes given here can be small or large as I've not tested them so set/adjust them according to your requirement.
And yes, if this doesn't work, please let me know, I'll provide more help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With