Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Partially visible Action Mode Icons android

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.

Action mode Icons

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

like image 551
user934820 Avatar asked Aug 21 '17 09:08

user934820


People also ask

What are adaptive icons?

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.

What are Android icons?

Android O icons represent your app on a device's Home and All Apps screens.


1 Answers

Chances are there that it's becuase of less height than the icons require.

You can try this.

  1. 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>
    
  2. 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.

like image 104
Lalit Fauzdar Avatar answered Sep 29 '22 19:09

Lalit Fauzdar