是否有人知道如何設置AutoCompleteTextView結果的大小?如何設置AutoCompleteTextView結果的大小?
我嘗試android:textSize="12sp"
但只修改文本的大小TextView的,而不是結果。
是否有人知道如何設置AutoCompleteTextView結果的大小?如何設置AutoCompleteTextView結果的大小?
我嘗試android:textSize="12sp"
但只修改文本的大小TextView的,而不是結果。
最好的方法是創建自己的
1)創建一個XML文件與您定製的設計......如「dropdown.xml」
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textAutoComplete"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#F3F5E1"
android:gravity="center_vertical"
android:padding="5dp" />
,並在代碼中使用這個
AutoCompleteTextView etChoose= (AutoCompleteTextView) findViewById(R.id.etChoose);
ArrayAdapter<String> adapterChoose = new ArrayAdapter<String>(this,R.layout.dropdown, ChooseList);
只需添加機器人:在XML文件dropDownHeight = 「大小」 AutoCompleteTextView
問題中的圖片顯示了改變單個物品高度的願望。設置'dropDownHeight'可以改變整個下拉菜單的高度。 – 2017-11-14 09:40:34
private ArrayAdapter<String> autoCompleteAdapter = new ArrayAdapter<String>
(this,android.R.layout.simple_list_item_1, yourList){
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
((TextView) v).setTextSize(14);
Typeface Type = getFont() ; // custom method to get a font from "assets" folder
((TextView) v).setTypeface(Type);
((TextView) v).setTextColor(YourColor);
((TextView) v) .setGravity(Gravity.LEFT|Gravity.CENTER_VERTICAL);
return v;
}
};
YourAutoCompleteView.setAdapter(autoCompleteAdapter);
謝謝:),你救了我半小時。 – 2017-02-16 13:56:15