I have a listview with background image for each item. My question is how to select multiple items in the list and how to change their background. With this code i am able to select only 1 item at a time. Below is my xml for the listview.
main.xml
<ListView android:layout_height="350dp" android:id="@id/ListView01" android:layout_width="fill_parent"></ListView>
itemrow.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@layout/list_bg"
android:orientation="vertical">
<TextView android:id="@+id/name"
android:textSize="16sp" android:paddingLeft="25dp"
android:textStyle="bold" android:text="hello"
android:textColor="#FFFFFF" android:gravity="center_vertical"
android:layout_width="fill_parent" android:layout_height="wrap_content"/>
</LinearLayout>
list_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_selected="true"
android:drawable="@android:color/transparent" />
<item
android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/cellbgnew" />
<item android:state_pressed="true"
android:drawable="@drawable/cellbghover" />
<item android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/cellbghover" />
</selector>