2011-12-25 21 views
0

私は自分のレイアウトの背景色を白として追加しました。リストビューはフォーカスできません。私が背景色を白にした場合

次に、BaseAdapterクラスを拡張してリストを作成しました。 しかし、私のリストアイテムはフォーカス可能ではありません(フォーカスカラーを表示しないアイテムにカーソルを移動すると)。

レイアウトの背景色タグを削除すると、それはうまくいきます。下は自分のxmlレイアウトです。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" android:background="@color/color_white"> 

     <ImageView 
     android:id="@+id/icon" 
     android:layout_width="60dp" 
     android:layout_height="wrap_content" 
     android:visibility="visible" /> 

    <TextView 
     android:id="@+id/label" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="10px" 
     android:textColor="@color/color_white" 
     android:textSize="20dp" 
     android:visibility="visible" /> 
</LinearLayout> 

助けてください。

答えて

0

リスト項目の背景は、ビューのさまざまな状態の色を定義する"State List Drawables"です。背景を単純な色に設定すると、すべてのインスタンスでその色になります。残りの色をそのまま維持するには、デフォルトドロアブル内の特定の「状態」をオーバーライドする必要があります。ここにはexampleがあります。

関連する問題