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
1 | ArrayAdapter<String> adapter = new ArrayAdapter<String>( this , R.layout.activity_auto _complete_new_style, autoInfo); |
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。