[android-developers] Re: How to mark an element visually in ListView the user clicked on?

2011-06-12 Thread Scythe
Thanks, I was looking for this 'activated' state. The methods and
states related to selecting elements from the list completely
confused me. It turned out that the in ListView's context, selecting
an element means that the user navigates the focus around in the list
with the d-pad... And yes, I'm using Honeycomb, so my list needs to
stay on screen, and display the previously selected element.

So currently I'm setting the selected element's view activated, and
assigned a custom selector with a distinct background color for the
activated state for the row's layout.

On Jun 12, 5:07 pm, Mark Murphy mmur...@commonsware.com wrote:
 singleChoice requires your row Views to implement the Checkable
 interface, as I recall.

 On Honeycomb, your desired look is achieved by setting the activated
 state on the row Views. On phones, since the ListView is not usually
 on the same screen as other stuff, your desired pattern isn't really
 part of the framework.









 On Sun, Jun 12, 2011 at 11:04 AM, Scythe scythe...@gmail.com wrote:
  I have a ListView with a custom adapter. I'd like to visually mark the
  list element the user clicked on by changing it's background
  permanently (until the user clicks on another element that is). How do
  I achieve that? I believe that there's a built-in feature inside
  LisView for this, but I had no luck finding it yet.

  By default ListView animates the background color of the list-element
  clicked, I just want that modified color to stay. I've already set
  the ListView's ChoiceMode to single choice, but it doesn't affect it
  visually.

  Thanks

  --
  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

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Android Training in NYC:http://marakana.com/training/android/

-- 
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


Re: [android-developers] Re: How to mark an element visually in ListView the user clicked on?

2011-06-12 Thread Mark Murphy
On Sun, Jun 12, 2011 at 1:04 PM, Scythe scythe...@gmail.com wrote:
 Thanks, I was looking for this 'activated' state. The methods and
 states related to selecting elements from the list completely
 confused me. It turned out that the in ListView's context, selecting
 an element means that the user navigates the focus around in the list
 with the d-pad... And yes, I'm using Honeycomb, so my list needs to
 stay on screen, and display the previously selected element.

 So currently I'm setting the selected element's view activated, and
 assigned a custom selector with a distinct background color for the
 activated state for the row's layout.

Yup, that's the ticket. Activated and singleChoice is the trick to
the Honeycomb show the tapped-on item in the ListFragment, to provide
context for an adjacent fragment.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in NYC: http://marakana.com/training/android/

-- 
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