@ SuppressWarnings ( "deprecation" ) @ SuppressLint ( "NewApi" ) public void setBackgroundCompat ( Drawable drawable ) { int pL = getPaddingLeft ( ) ; int pT = getPaddingTop ( ) ; int pR = getPaddingRight ( ) ; int pB = getPaddingBottom ( ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) { setBackground ( drawable ) ; } else { setBackgroundDrawable ( drawable ) ; } setPadding ( pL , pT , pR , pB ) ; }
Set the View s background . Masks the API changes made in Jelly Bean .