ismaeldivita / chip-navigation-bar

An android navigation bar widget
MIT License
890 stars 136 forks source link

Icon animation "state_checked"=true/false not working #97

Open AsitDixit opened 2 years ago

AsitDixit commented 2 years ago

Just like material bottom navigation bar I want to achieve something like: When icon selected : filled icon When icon not selected : Outlined icon

IN PLACE OF MENU ITEMS ICON I'M USING BELOW XML FILE :

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/homeoutline" android:state_checked="false"/>
    <item android:drawable="@drawable/homefilled" android:state_checked="true"/>
</selector>

But this is not working I'm getting outlined icon every time whether icon selected or not selected. Please help.

enesarisoy commented 7 months ago

Just like material bottom navigation bar I want to achieve something like: When icon selected : filled icon When icon not selected : Outlined icon

IN PLACE OF MENU ITEMS ICON I'M USING BELOW XML FILE :

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/homeoutline" android:state_checked="false"/>
    <item android:drawable="@drawable/homefilled" android:state_checked="true"/>
</selector>

But this is not working I'm getting outlined icon every time whether icon selected or not selected. Please help.

try android:state_selected not android:state_checked

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/homeoutline" android:state_selected="false"/>
    <item android:drawable="@drawable/homefilled" android:state_selected="true"/>
</selector>