public void setSwitchTextAppearance ( Context context , int resid ) { TypedArray appearance = context . obtainStyledAttributes ( resid , R . styleable . TextAppearanceAccentSwitch ) ; ColorStateList colors ; int ts ; colors = appearance . getColorStateList ( R . styleable . TextAppearanceAccentSwitch_android_textColor ) ; if ( colors != null ) { mTextColors = colors ; } else { // If no color set in TextAppearance, default to the view's // textColor mTextColors = getTextColors ( ) ; } ts = appearance . getDimensionPixelSize ( R . styleable . TextAppearanceAccentSwitch_android_textSize , 0 ) ; if ( ts != 0 ) { if ( ts != mTextPaint . getTextSize ( ) ) { mTextPaint . setTextSize ( ts ) ; requestLayout ( ) ; } } int typefaceIndex , styleIndex ; typefaceIndex = appearance . getInt ( R . styleable . TextAppearanceAccentSwitch_android_typeface , - 1 ) ; styleIndex = appearance . getInt ( R . styleable . TextAppearanceAccentSwitch_android_textStyle , - 1 ) ; setSwitchTypefaceByIndex ( typefaceIndex , styleIndex ) ; boolean allCaps = appearance . getBoolean ( R . styleable . TextAppearanceAccentSwitch_android_textAllCaps , false ) ; if ( allCaps ) { mSwitchTransformationMethod = new AllCapsTransformationMethod ( getContext ( ) ) ; mSwitchTransformationMethod . setLengthChangesAllowed ( true ) ; } else { mSwitchTransformationMethod = null ; } appearance . recycle ( ) ; }
Sets the switch text color size style hint color and highlight color from the specified TextAppearance resource .