0

The Drop-down content of AutoCompleteTextView is the white word. But it can not be seen clear. How to deal with this?

This is my code:

ArrayAdapter<String> myAdapter=new ArrayAdapter<String>
(this,android.R.layout.browser_link_context_header, info_array);

The font still can not be seen clear. Then I change the code like this: myAdapter.setDropDownViewResource(R.layout.dropdown_tv);

It still can not see the font. Please help me. Thanks very much!

Ahmad Kayyali
  • 8,233
  • 13
  • 49
  • 83
DaringLi
  • 409
  • 2
  • 6
  • 16

2 Answers2

2

I suggest to keep whatever theme you have for the app as it is, and only change the theme in this activity that have the AutoCompleteTextView to setTheme(android.R.style.Theme);

here some guy solved it by overriding Widget.AutoCompleteTextView theme check didldum answer here it might help you:

Quoted from code.google.com

1. use an extended theme in your manifest:
...
<application android:theme="@style/Theme.Light.NoTitleBar.Workaround" ... >
...

2. create the new theme (res/values/themes.xml) which uses fixed styles:
...
    <style name="Theme.Light.NoTitleBar.Workaround" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewLight</item>
        <item name="android:dropDownItemStyle">@style/Widget.DropDownItemLight</item>
    </style>
...

3. create the styles (res/values/styles.xml) which fix the color:
...
    <style name="AutoCompleteTextViewLight" parent="@android:style/Widget.AutoCompleteTextView">
        <item name="android:textColor">@android:color/primary_text_light</item>
    </style>
    <style name="Widget.DropDownItemLight" parent="@android:style/Widget.DropDownItem">
        <item name="android:textColor">@android:color/primary_text_light</item>
    </style>
...
Ahmad Kayyali
  • 8,233
  • 13
  • 49
  • 83
0

I had the same problem But I was use android Support Library. and Theme.AppCompat.Light Theme.

My problem was happen only with android 2.3 devices.

I had solve problem by change layout of drop down To :

R.layout.support_simple_spinner_dropdown_item
ahmed hamdy
  • 5,096
  • 1
  • 47
  • 58