本文整理匯總了Java中android.widget.AutoCompleteTextView.setCompletionHint方法的典型用法代碼示例。如果您正苦於以下問題:Java AutoCompleteTextView.setCompletionHint方法的具體用法?Java AutoCompleteTextView.setCompletionHint怎麽用?Java AutoCompleteTextView.setCompletionHint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.AutoCompleteTextView
的用法示例。
在下文中一共展示了AutoCompleteTextView.setCompletionHint方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: applyStyle
import android.widget.AutoCompleteTextView; //導入方法依賴的package包/類
private static void applyStyle(AutoCompleteTextView v, int styleRes){
TypedArray a = v.getContext().obtainStyledAttributes(null, R.styleable.AutoCompleteTextView, 0, styleRes);
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();
}
示例2: applyStyle
import android.widget.AutoCompleteTextView; //導入方法依賴的package包/類
/**
* 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();
}