Re: [android-developers] how do I highlight (color) a range of entries in a ListView?
On Sat, Jul 16, 2011 at 9:19 AM, Jim Graham <spooky130u@gmail.com> wrote:
> So, here goes. How, from the code, can I determine the exact
> location (top of display, bottom of display, specific point in
> between on the display, ec.) where row 42 (or whatever) is at?
I've never done this, so this is very rough. YMMV. Also, I am assuming
that 42 is a position and that you have no headers or footers on the
list.
Step #1: Confirm that 42 is in the range from
getFirstVisiblePosition() to getLastVisiblePosition(). Do something if
it's not.
Step #2: If it is, subtract 42 from getFirstVisiblePosition() to get a
child index.
Step #3: Call getChildAt() to get the row View at the specified child index.
Step #4: Use stuff like getX(), getY(), etc. to find out where that View is.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Warescription: Three Android Books, Plus Updates, One Low Price!
--
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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home