v mojom AutoCompleteTextView text nie jeviditeľné po výbere položky zo zoznamu návrhov. Snažil som sa s setTextColor (android.R.color.black), ale nefunguje to. Používam Theme.Light in Manifest. Má niekto nápad, čo mám robiť?
Vopred ďakujem
Tiziano
odpovede:
5 pre odpoveď č. 1prosím skús
Resources res = getResources();
int color = res.getColor(android.R.color.black);
setTextColor(color )
http://sree.cc/google/android/defining-custom-colors-using-xml-in-android
3 pre odpoveď č. 2
Použite android.R.layout.select_dialog_item ako android.R.layout.simple_dropdown_item_1line, bude to fungovať.
1 pre odpoveď č. 3
Vytvoriť vlastné rozloženie my_dropdown_item.xml:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="40dip"
android:ellipsize="marquee"
android:textColor="#000000"/>
Potom ju použite:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.my_dropdown_item, YOURARRAY);
1 pre odpoveď č. 4
Bude to v poriadku:
adapter = new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_dropdown_item_1line, string_resource);
Resources res = getResources();
int color = res.getColor(android.R.color.black);
autoCompleteTextView.setTextColor(color);
autoCompleteTextView.setAdapter(adapter);
0 pre odpoveď č. 5
Odpoveď didldum https://code.google.com/p/android/issues/detail?id=5237
riešenie rozšírením témy a prepísaním 2 štýlov zadaného textu a navrhovaného textu:
použite vo svojom manifeste rozšírenú tému: ... ...
vytvorte novú tému (res / hodnoty / themes.xml), ktorá používa pevné štýly: ... @ style / AutoCompleteTextViewLight @ style / Widget.DropDownItemLight ...
vytvorte štýly (res / hodnoty / styles.xml), ktoré upravujú farbu: ... @android: color / basic_text_light @android: color / basic_text_light
0 pre odpoveď č. 6
Ešte jednoduchší spôsob je nastaviť farbu pozadia vášho AutoCompleteTextView na bielu. Ako toto: android:background="@android:color/white"