Here is an example for you ... http://life-as-a-coder.com/_shared/background_state.rar
Take a look at my main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:layout_width="fill_parent" android:layout_height="50dip" android:background="@drawable/item_background" android:clickable="true"> <TextView android:text="Item 1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="35dip"></TextView> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="50dip" android:background="@drawable/item_background" android:clickable="true"> <TextView android:text="Item 2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="35dip"></TextView> </LinearLayout> </LinearLayout>
I am using LinearLayout for this example. I set android:clickable="true" to activate the click state ... It can also be used in a ListView ... just use it in the custom line Item ...
Sorry for my bad english grammar n
source share