2012-07-29 84 views
4

我建立了按钮选择,具有状态列表绘制,请告诉我android.R.attr.state_checked的相反?

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

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

我应该把什么排在第二状态? 有没有android.R.attr.state_unchecked

回答

10

This question可能会帮助你。

它说,你应该用你所需要的状态的负值。所以你的情况应该是:

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