使用new BMap.Autocomplete关键字提示,怎么设置下拉框的样式
1个回答
展开全部
AutoCompleteTextView修改下拉样式
<AutoCompleteTextView
2 android:id="@+id/actxt"
3 android:layout_width="fill_parent"
4 android:layout_height="wrap_content"
5 android:layout_below="@id/tv"
6 android:completionThreshold="1" />
1 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_ dropdown_item_1line, autoInfo);
AutoCompleteTextView默认使用simple_dropdown_item_1line时, 下拉框是白色的,选择的字体也是白色的,看不到。解决:1.自定义layout,控制样式,比如用个TextView;
01 <?xml version="1.0" encoding="UTF-8"?>
02 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
03 android:id="@android:id/text1"
04 style="?android:attr/dropDownItemStyle"
05 android:layout_width="fill_parent"
06 android:layout_height="?android:attr/listPreferredItemHeight"
07 android:ellipsize="marquee"
08 android:singleLine="true"
09 android:textAppearance="?android:attr/textAppearanceLargeInverse"
10 android:textColor="#000000" />
2.替换默认的simple_dropdown_item_1line
view sourceprint?
1 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.activity_auto _complete_new_style, autoInfo);
<AutoCompleteTextView
2 android:id="@+id/actxt"
3 android:layout_width="fill_parent"
4 android:layout_height="wrap_content"
5 android:layout_below="@id/tv"
6 android:completionThreshold="1" />
1 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_ dropdown_item_1line, autoInfo);
AutoCompleteTextView默认使用simple_dropdown_item_1line时, 下拉框是白色的,选择的字体也是白色的,看不到。解决:1.自定义layout,控制样式,比如用个TextView;
01 <?xml version="1.0" encoding="UTF-8"?>
02 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
03 android:id="@android:id/text1"
04 style="?android:attr/dropDownItemStyle"
05 android:layout_width="fill_parent"
06 android:layout_height="?android:attr/listPreferredItemHeight"
07 android:ellipsize="marquee"
08 android:singleLine="true"
09 android:textAppearance="?android:attr/textAppearanceLargeInverse"
10 android:textColor="#000000" />
2.替换默认的simple_dropdown_item_1line
view sourceprint?
1 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.activity_auto _complete_new_style, autoInfo);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询