本文整理汇总了Java中android.widget.AutoCompleteTextView.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java AutoCompleteTextView.setLayoutParams方法的具体用法?Java AutoCompleteTextView.setLayoutParams怎么用?Java AutoCompleteTextView.setLayoutParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.AutoCompleteTextView
的用法示例。
在下文中一共展示了AutoCompleteTextView.setLayoutParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAutoCompleteTextView
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private AutoCompleteTextView createAutoCompleteTextView(Context context) {
final LayoutParams lparamsTextView = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lparamsTextView.setMargins(0, 0, 10, 0);
lparamsTextView.gravity = Gravity.CENTER;
final AutoCompleteTextView autoCompleteTextView = new AutoCompleteTextView(context);
autoCompleteTextView.setBackgroundColor(Color.parseColor("#00FFFFFF"));
autoCompleteTextView.setLayoutParams(lparamsTextView);
autoCompleteTextView.setHint(" ");
autoCompleteTextView.setPadding(10,0,10,10);
autoCompleteTextView.setSingleLine(true);
autoCompleteTextView.setTextColor(textColor);
autoCompleteTextView.setHintTextColor(hintColor);
autoCompleteTextView.setCursorVisible(true);
return autoCompleteTextView;
}
示例2: createNewTextView
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private AutoCompleteTextView createNewTextView(final EditText et) {
final TableRow.LayoutParams lparams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
final AutoCompleteTextView textView = new AutoCompleteTextView(this.getContext());
lparams.weight = 10;
textView.setHint(R.string.add_ingredient);
textView.setLayoutParams(lparams);
textView.setAdapter(adapter);
textView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Ingredient ingr = (Ingredient) adapterView.getAdapter().getItem(i);
ViewGroup vg= (ViewGroup) textView.getParent();
setETsForUnits(ingr.getMeasureUnit(),ingr.getMeasureValue(),ingr.getDefaultUnit(),ingr.getDefaultValue(),vg);
}
});
return textView;
}