GingerBread ListView не работает

Этот код работает на KitKat, а на GingerBread - нет.
При нажатии или выделении списка я не получаю другой выбранный цвет на GingerBread, но на KitKat он работает нормально.

List_selector.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/list_item_bg_normal" android:state_activated="false"/>
<item android:drawable="@drawable/list_item_bg_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/list_item_bg_pressed" android:state_activated="true"/>

 </selector>

list_item_bg_normal

<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">

<solid android:color="@color/list_background_pressed" />

 </shape>

list_item_bg_pressed

<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">

<solid android:color="@color/list_background" />

 </shape>

мой список

 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >


 <ListView 
    android:id="@+id/list_accounts"
    android:paddingLeft="20dp"
    android:paddingRight="20dp"
    android:paddingTop="20dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:listSelector="@android:color/transparent"
    android:dividerHeight="20dp"      />


   </RelativeLayout>

list_item.xml

    <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
 android:background="@drawable/list_selector"
>

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:textColor="#61269e"
            android:text="A/C Number"/>

        <TextView
            android:id="@+id/accountNumber"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
             android:textColor="#61269e"
            android:layout_weight="1"/>
    </LinearLayout>


 </LinearLayout>

0 ответов

Другие вопросы по тегам