Hi guys,
Yeah I had this problem when I started with Android last year.
So my users want to select an item from a ListView, then may scroll
around a bit more. I don't understand why we should prevent the item
they selected from being highlighted? I've done this:
listView.setItemsCanFocus(false);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
// my adapter:
public View getView(int position, View convertView, ViewGroup
parent) {
if (listView.getCheckedItemPosition() == position) {
view.setBackgroundColor(orange);
}
else {
view.setBackgroundColor(default);
}
}
I read through the document linked, but still cannot appreciate the
rationale behind disallowing a ListView item from having a 'selected'
color when in TouchMode,
Thanks
On Jun 19, 12:20 pm, Peli <[email protected]> wrote:
> Romain's blog post will answer all your
> questions:http://android-developers.blogspot.com/2008/12/touch-mode.html
>
> (read until the end until you see the paragraph about "choice mode" -
> which is what you need).
>
> Peliwww.openintents.org
>
> On Jun 19, 6:01 pm, Mark Wyszomierski <[email protected]> wrote:
>
> > Hi,
>
> > I have a ListView. When I click a row Item (which are just TextView
> > instances) I want them to remain hilighted (default orange color). The
> > default behavior is that they flash orange.
>
> > Strangely, if I use the key pad (arrow up/down) to move between items,
> > it has the exact behavior I want. Why is the logic different between
> > using the keypad or with finger tapping?
>
> > Thanks
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---