Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AsitDixit opened this issue Sep 16, 2022 · 1 comment
Open

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

AsitDixit opened this issue Sep 16, 2022 · 1 comment

Comments

@AsitDixit
Copy link

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
Copy link

enesarisoy commented Apr 3, 2024

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants