It's actually pretty simple, but it took me a little while to figure
out. You have to set the list to allow its items to be focusable, and
then set whichever items you want to be clickable, focusable, and have
a background to display when clicked.
So first, call setItemsCanFocus(true) on your list. If you are using
a ListActivity, you can get the list by calling getListView().
Then, when you are inflating your views for each row in the list, for
each view you want to be clickable, do the following:
setClickable(true);
setFocusable(true);
setBackgroundResource(android.R.drawable.menuitem_background);
This will display the typical orange "highlight" behind the clickable
views, but you can create a different color drawable if you prefer.
If you have a couple of views (such as multiple TextViews) that you
want to group together into one clickable view, just group them in a
ViewGroup such as LinearLayout, and set these properties on that
ViewGroup.
Good luck!
-rich
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---