示例#1
0
 /**
  * Change the checked state of this button immediately without showing animation.
  *
  * @param checked The checked state.
  */
 public void setCheckedImmediately(boolean checked) {
   if (mButtonDrawable instanceof RadioButtonDrawable) {
     RadioButtonDrawable drawable = (RadioButtonDrawable) mButtonDrawable;
     drawable.setAnimEnable(false);
     setChecked(checked);
     drawable.setAnimEnable(true);
   } else setChecked(checked);
 }
示例#2
0
  @Override
  protected void applyStyle(
      Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super.applyStyle(context, attrs, defStyleAttr, defStyleRes);

    RadioButtonDrawable drawable =
        new RadioButtonDrawable.Builder(context, attrs, defStyleAttr, defStyleRes).build();
    drawable.setInEditMode(isInEditMode());
    drawable.setAnimEnable(false);
    setButtonDrawable(drawable);
    drawable.setAnimEnable(true);
  }