JoanZapata / android-iconify

Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
http://joanzapata.com/android-iconify
Other
3.93k stars 525 forks source link

Applying state style not working on Android M? #173

Open CodigoAndroid-es opened 8 years ago

CodigoAndroid-es commented 8 years ago

Hi,

Thank for the library, it's great,

I've got a Navigation View, which menu is just a simple xml menu:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <group android:id="@+id/navmenu_grupo1" android:checkableBehavior="single">
        <item
            android:id="@+id/menu_inicio"
            android:checked="true"
            android:title="@string/menu_inicio" />
        <item
            android:id="@+id/menu_agenda"
            android:checked="false"
            android:title="@string/menu_agenda" />
....
</group>
</menu>

I'm not declaring any icon here. I do it on my Activity with

IconDrawable menu_inicio = new IconDrawable(this, FontAwesomeIcons.fa_home);

Then I set the icon for each menuItem

navigationview_menu.findItem(R.id.menu_inicio).setIcon(menu_inicio);

Everything´s working well. Then I want to style my drawer. So here is my drawer code:

<android.support.design.widget.NavigationView
        android:id="@+id/NavigationView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/header_navview"
        app:itemBackground="@android:color/white"

        app:itemIconTint="@color/navigation_view_menu"
        app:itemTextColor="@color/navigation_view_menu"

        app:menu="@menu/menu_navview"
        >

So, for the icon color I set the following color state resource

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#FF6666" android:state_checked="true" />
<item android:color="#424242" android:state_checked="false"/>
</selector>

This all works perfect in all versions I've tested but in Android M (Geny emulator and my own device), the icon doesn´t change its color, only the text.

This is Android 4.1

nav_4 1

This is Android 6.0 nav_6

Has this anything to do with the library? Because when I declare the icons on the xml menu, it works well also in Android M

Thanks