private static void applyStyle ( AutoCompleteTextView v , AttributeSet attrs , int defStyleAttr , int defStyleRes ) { TypedArray a = v . getContext ( ) . obtainStyledAttributes ( attrs , R . styleable . AutoCompleteTextView , defStyleAttr , defStyleRes ) ; int n = a . getIndexCount ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int attr = a . getIndex ( i ) ; if ( attr == R . styleable . AutoCompleteTextView_android_completionHint ) v . setCompletionHint ( a . getString ( attr ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_completionThreshold ) v . setThreshold ( a . getInteger ( attr , 0 ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownAnchor ) v . setDropDownAnchor ( a . getResourceId ( attr , 0 ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownHeight ) v . setDropDownHeight ( a . getLayoutDimension ( attr , ViewGroup . LayoutParams . WRAP_CONTENT ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownWidth ) v . setDropDownWidth ( a . getLayoutDimension ( attr , ViewGroup . LayoutParams . WRAP_CONTENT ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownHorizontalOffset ) v . setDropDownHorizontalOffset ( a . getDimensionPixelSize ( attr , 0 ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_dropDownVerticalOffset ) v . setDropDownVerticalOffset ( a . getDimensionPixelSize ( attr , 0 ) ) ; else if ( attr == R . styleable . AutoCompleteTextView_android_popupBackground ) v . setDropDownBackgroundDrawable ( a . getDrawable ( attr ) ) ; } a . recycle ( ) ; }
Apply any AutoCompleteTextView style attributes to a view .