1

So in a ListView I have tasks for example "3:00 PM Sunday washing the car" and After I wash the car I want to click on the task(item) on the ListView and change the color so that I know that I have finished that task.

   <ListView
      android:id="@android:id/list"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_below="@+id/nTask"
      android:background="#FFFFFF" >
   </ListView>

Color1.xml

     <?xml version="1.0" encoding="utf-8"?>
     <selector xmlns:android="http://schemas.android.com/apk/res/android">
 <item android:state_pressed="true" android:drawable="@drawable/selector_state_blue"/>

selector_state_blue.xml

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

  <gradient
    android:angle="270"
    android:endColor="#FF91B2FF"
    android:startColor="#4491B2FF" />

  <corners android:radius="10px" />

 </shape>
Curious
  • 41
  • 7
  • 1
    use a selector http://stackoverflow.com/questions/16976431/change-background-color-of-selected-item-on-a-listview/16976534#16976534 check this also http://stackoverflow.com/questions/2562051/listview-item-background-via-custom-selector – Raghunandan Jun 08 '13 at 19:09
  • @Raghunandan thank u,the second link looks helpful..can u give me at least a Vote :) – Curious Jun 08 '13 at 22:04

0 Answers0