本文介绍了我的AutoCompleteTextView的textColor总是白色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
由于某种原因,无论我做什么,AutoCompleteTextView中显示的文本始终为白色.我已经在XML中将textColor显式设置为黑色.我想知道android.R.layout.simple_list_item_1默认情况下是白色吗?
For some reason, no matter what I do the text coming up in my AutoCompleteTextView is always white. I've explicitly set textColor to black in my XML. I'm wondering if android.R.layout.simple_list_item_1 is white by default?
在这里设置我的ArrayAdapter:
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, strings);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.searchUserTextField);
textView.setAdapter(adapter);
这是我的XML:
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="65dp"
android:background="@drawable/edittext_border"
android:layout_gravity="top"
android:textColor="#000000"
android:hint="@string/search_user"
android:id="@+id/searchUserTextField"
android:ems="150"
android:paddingLeft="25dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="10dp"
android:maxLines ="4"
android:maxLength ="150"
android:scrollHorizontally="false"
android:typeface="sans"
android:textSize="14sp"
android:fontFamily="sans-serif-light"
android:capitalize="none"
android:inputType="textEmailAddress"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/submitSearch"
android:layout_toStartOf="@+id/submitSearch" />
推荐答案
看起来像是AOSP中已记录的错误.您可以在这篇文章中找到更多信息以及解决方法 AutoCompleteTextview默认情况下将颜色设置为白色
Looked like its a logged bug in AOSP. You can find some more information as well as workarounds in this post AutoCompleteTextview Color set white by default
这篇关于我的AutoCompleteTextView的textColor总是白色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!