Thanks Sandeep,

It works nicely. Just curious, is this the usual way to do it?

Regards,
CJ

On Dec 28, 7:58 pm, Sandeep N M <[email protected]> wrote:
> Add this to layout/list.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="wrap_content" android:background="#f8f8f8">
>
>         <ListView android:id="@+id/list" android:layout_width="fill_parent"
>                 android:layout_height="wrap_content" android:layout_weight="1"
>                 android:cacheColorHint="#000000"
>                 />
> </LinearLayout>
>
> Add this in drawable/selector.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/
> orange" />
>     <item android:drawable="@drawable/white" />
> </selector>
>
> orange and white are 1X1 pixel images of what ever color you want.
>
> add this to layout/item.xml
>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>         android:id="@+id/vw1" android:layout_width="fill_parent"
>         android:layout_height="wrap_content" android:orientation="horizontal"
>     android:background="@drawable/selector">
>
> <TextView android:id="@+id/text" android:textColor="#151515"
>                 android:textSize="16sp" android:layout_width="220px"
>                 android:layout_height="60px" android:layout_marginLeft="8px"
>                 android:typeface="sans" />
>
> </LinearLayout>
>
> Regards,
> Sandeep
>
> On Dec 28, 9:02 am, Mystique <[email protected]> wrote:
>
>
>
>
>
>
>
> > I just want the selector to be as default, when I select an item I see
> > color change. But when I change my xml the selector is no longer
> > working. Why is this so?
> > ---
> > <?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="@color/background"
> >         android:padding="10sp">
>
> >     >
> > <TextView
> >         android:id="@+id/list"
> >         android:layout_width="fill_parent"
> >                 android:layout_height="fill_parent"
> >         android:singleLine="true"
> >         android:textAppearance="?android:attr/textColor"
> >         android:gravity="center_vertical|left">
> > </TextView>
> > </LinearLayout>
> > ---
>
> > Many thanks,
> > CJ

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to