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

Why selector drawable doesn't work? #1136

Open
vivekgupta4Git opened this issue Dec 12, 2022 · 0 comments
Open

Why selector drawable doesn't work? #1136

vivekgupta4Git opened this issue Dec 12, 2022 · 0 comments

Comments

@vivekgupta4Git
Copy link

In sample app, we have state list drawable my_selector (In example MySelectorDecorator using this selector )

Inside of which, we have defined states when user select a date , it will decorate the drawable on selected date and remaining will be transparent but what if I want show drawable for rest but when selected make it transparent or different color?

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
    android:exitFadeDuration="@android:integer/config_shortAnimTime">

  <item android:drawable="@drawable/ic_my_selector" android:state_checked="false"/>

  <item android:drawable="@drawable/ic_my_selector" android:state_pressed="false"/>

  <item android:drawable="@android:color/transparent" android:state_checked="true"/>

</selector>

the result is unexpected, it shows all dates are decorated and when we press on a date ,if it is transparent nothing will change but if we have used some different color says orange , it will blink orange for a milli sec and goes away. Why states aren't maintained? Am I missing something? How can I achieve the expected behavior?

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

1 participant