9

アクティビティ内に AutoCompleteTextView があり、本来の方法で実行されます。ドロップダウンの弓は正しいエントリなどで表示されます。問題は、ビューがフォーカスを失うと、テキストが表示されなくなることです。フォーカスが再び得られると、テキストが表示されます。

他の誰かがこの問題を抱えていますか? それはバグですか、それとも私が間違っていることですか?

4

2 に答える 2

0

おそらく、アイテムにフォーカスしていない場合、TextColor は現在のテーマの背景色と同じです。そのため、それらを見ることはできません。フォーカスしているアイテムのテキストを参照してください。

解決: background_color に対して別の色を設定します。Adapter を作成するときに android.R.layout.simple_dropdown_item_1line などを使用するか、次のような独自の textViewResourceId を使用できます。

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
   android:textSize="20dp"
   android:gravity="center_vertical" 
   android:id="@android:id/text1" 
   android:paddingLeft="6.0dip" 
   android:paddingRight="6.0dip" 
   android:layout_width="fill_parent" 
   android:layout_height="50.0dip"
   android:textColor="@android:color/black"
   android:textColorHighlight="@android:color/black"    />
于 2011-12-21T07:05:40.637 に答える
0

textview の textcolor を設定するのと同じくらい簡単です。

 <AutoCompleteTextView
         android:layout_width="120dip"
         android:layout_height="wrap_content"
         android:singleLine="true"
         android:ems="10"
         android:textColor="@android:color/black" />
于 2013-03-29T14:22:52.843 に答える