打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
AutoCompleteTextView修改下拉样式


1<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" />
1ArrayAdapter<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
1ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.activity_auto                                _complete_new_style, autoInfo);

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Spinner样式大全
android Spinner控件详解
Android学习笔记:Activity
一步一步android(9):关于界面控件的学习3【spinner、autocompletetextview、NotificationBar
2.5.4 AutoCompleteTextView(自动完成文本框)的基本使用
《Android Dev Guide》系列教程18:通过适配器给AdapterView绑定...
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服