/** * 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); }
@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); }