Java Code Examples for android.widget.AutoCompleteTextView#setDropDownHeight()
The following examples show how to use
android.widget.AutoCompleteTextView#setDropDownHeight() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewUtil.java From MDPreference with Apache License 2.0 | 5 votes |
/** * Apply any AutoCompleteTextView style attributes to a view. * @param v * @param attrs * @param defStyleAttr * @param defStyleRes */ 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(); }
Example 2
Source File: ViewUtil.java From material with Apache License 2.0 | 5 votes |
/** * Apply any AutoCompleteTextView style attributes to a view. * @param v * @param attrs * @param defStyleAttr * @param defStyleRes */ 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(); }
Example 3
Source File: FloatingLabelAutoCompleteTextView.java From android-floatinglabel-widgets with Apache License 2.0 | 5 votes |
@Override protected void afterLayoutInflated(Context context, AttributeSet attrs, int defStyle) { super.afterLayoutInflated(context, attrs, defStyle); final CharSequence completionHint; final int completionThreshold; final int popupBackground; final int dropDownWidth; final int dropDownHeight; if (attrs == null) { completionHint = ""; completionThreshold = 1; dropDownHeight = ViewGroup.LayoutParams.WRAP_CONTENT; dropDownWidth = ViewGroup.LayoutParams.WRAP_CONTENT; popupBackground = getDefaultPopupBackgroundResId(); } else { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.FloatingLabelAutoCompleteTextView, defStyle, 0); completionHint = a.getText(R.styleable.FloatingLabelAutoCompleteTextView_android_completionHint); completionThreshold = a.getInt(R.styleable.FloatingLabelAutoCompleteTextView_android_completionThreshold, 1); dropDownHeight = a.getDimensionPixelSize(R.styleable.FloatingLabelAutoCompleteTextView_android_dropDownHeight, ViewGroup.LayoutParams.WRAP_CONTENT); dropDownWidth = a.getDimensionPixelSize(R.styleable.FloatingLabelAutoCompleteTextView_android_dropDownWidth, ViewGroup.LayoutParams.WRAP_CONTENT); popupBackground = a.getResourceId(R.styleable.FloatingLabelAutoCompleteTextView_android_popupBackground, getDefaultPopupBackgroundResId()); a.recycle(); } final AutoCompleteTextView inputWidget = getInputWidget(); inputWidget.setCompletionHint(completionHint); inputWidget.setThreshold(completionThreshold); inputWidget.setDropDownWidth(dropDownWidth); inputWidget.setDropDownHeight(dropDownHeight); inputWidget.setDropDownBackgroundResource(popupBackground); inputWidget.addTextChangedListener(new EditTextWatcher()); }