Android: Access child views from a ListView

Posted by lacker on Stack Overflow See other posts from Stack Overflow or by lacker
Published on 2008-11-02T22:40:49Z Indexed on 2010/03/20 16:01 UTC
Read the original article Hit count: 282

Filed under:

I need to find out the pixel position of one element in a list that's been displayed using a ListView. It seems like I should get one of the TextViews and then use getTop, but I can't figure out how to get a child view of a ListView.

Thanks!

Update: The children of the ViewGroup do not correspond 1-to-1 with the items in the list, for a ListView. Instead, the ViewGroup's children correspond to only those views that are visible right now. So getChildAt operates on an index that's internal to the ViewGroup and doesn't necessarily have anything to do with the position in the list that the ListView uses. :-/

© Stack Overflow or respective owner

Related posts about android