Ok

       lv.setDrawSelectorOnTop(true);
       lv.setSelector(R.drawable.list_selected);

does draw a drawable, but it wipes out the rest. I would only like to -of course - the background of the View which was the list item inthe unselected state. How would you do this?

----- Original Message ----- From: "Hendrik Greving" <fourhend...@gmail.com>
To: <android-developers@googlegroups.com>
Sent: Tuesday, October 19, 2010 11:21 PM
Subject: Re: [android-developers] Re: ListView setOnTouchListener


Hmm. I tried ListView... lv.setOnItemSelectedListener(AdapterView.OnItemSelectedListener() ....

It seems the callback isn't even called for my ListView. I've also experimented with <selection> .xml file and setting this as a background for a View to bind to the SimpleCursorAdapter. I don't know if this is supposed to work either. I thought the first way (setOnItemSelectedListener) is supposed to work, actually..


----- Original Message ----- From: "Kumar Bibek" <coomar....@gmail.com>
To: "Android Developers" <android-developers@googlegroups.com>
Sent: Tuesday, October 19, 2010 11:16 PM
Subject: [android-developers] Re: ListView setOnTouchListener


You should use the selectors for a list item and whenever you want to
set a selection, call the listview's method for that. Doing it on
touch, has a few bad effects, which are difficult to handle, or
atleast you would need a few lines of code to handle specific
gestures.

On Oct 20, 10:41 am, "Hendrik Greving" <fourhend...@gmail.com> wrote:
I have a ListView and a database cursor which I set with setListAdapter. The
adapter is a SimpleCursorAdapter which takes a xml description for the
ListView items. How can I set a onTouch handler for every item, in order to
highlight when it's being touched?

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

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

Reply via email to