public void setBackgroundColorRes ( int colorRes ) { ColorStateList colorStateList = UiCompat . getColorStateList ( getResources ( ) , colorRes ) ; if ( colorStateList == null ) setBackgroundColor ( 0 ) ; else setBackgroundColor ( colorStateList . getDefaultColor ( ) ) ; }
Set the background color by resource id