Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the opposite of android.R.attr.state_checked?

I'm building a selector for button, with a state list drawable,

  states.addState(new int[] {android.R.attr.state_checked},
                               checkedDrawable.getDrawable());

    states.addState(new int[] {},
                               unCheckDrawable.getDrawable());

What should I put in second state ? there is no android.R.attr.state_unchecked

like image 666
Chen Kinnrot Avatar asked Jul 29 '12 10:07

Chen Kinnrot


1 Answers

This question might help you.

It says, that you should use the negative of the state you need. So in your case it should be:

states.addState(new int[] {-android.R.attr.state_checked}, unCheckDrawable.getDrawable());
like image 121
Tim Roes Avatar answered Sep 23 '22 17:09

Tim Roes