Friday, January 25, 2013

Re: [android-developers] ListView select a row



On Friday, January 25, 2013 11:57:17 PM UTC+4, dashman wrote:
Thanks I will do that.

There seems to be api for selectedIndex etc - but not sure what they're for??

They're for keeping track of user selected items.

For example, listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE) will maintain at most one item as selected.

The selection state is propagated into your item layouts as android:state_checked (all Android versions, requires that the item layout implements Checkable) or android:state_activated (Android 3.0 and above). You can provide visual indication of those states by using a state list drawable.

 

How can I find the hi-light color (based on the current active theme).

Theme attributes: activatedBackgroundIndicator (3.0 and above), colorActivatedHighlight (4.0 and above).

-- K
 




On Friday, January 25, 2013 1:46:06 PM UTC-5, TreKing wrote:

On Fri, Jan 25, 2013 at 11:53 AM, dashman <erjd...@gmail.com> wrote:
I have a ListView with a ListAdapter.

When the user clicks on a row - i'd like to show that row as selected
(i.e. hilighted).

actually make it a toggle.

how do i do that.

Keep the "selection state" as part of your data model. Your getView for the adapter then changes the highlight depending on whether the item is selected or not.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices

--
--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
 
 

No comments:

Post a Comment