public void setIcon ( Drawable icon , boolean animation ) { if ( icon == null ) return ; if ( animation ) { mSwitchIconAnimator . startAnimation ( icon ) ; invalidate ( ) ; } else { if ( mIcon != null ) { mIcon . setCallback ( null ) ; unscheduleDrawable ( mIcon ) ; } mIcon = icon ; float half = mIconSize / 2f ; mIcon . setBounds ( ( int ) ( mBackground . getCenterX ( ) - half ) , ( int ) ( mBackground . getCenterY ( ) - half ) , ( int ) ( mBackground . getCenterX ( ) + half ) , ( int ) ( mBackground . getCenterY ( ) + half ) ) ; mIcon . setCallback ( this ) ; invalidate ( ) ; } }
Set the drawable that is used as this button s icon .