Correct, the views aren't created until the layout of the view
hierarchy happens, so it only needs to create enough views to show all
visible items.

I already answered someone else wanting to do the same thing:

http://groups.google.com/group/android-developers/browse_thread/thread/4e2c0cd419d56f5b/55b158a711c64cec#55b158a711c64cec

On Oct 12, 8:14 am, "Li Wei" <[EMAIL PROTECTED]> wrote:
> Thanks,
> But when I ran below code, it got a null:
>
>   View v = listView.getChildAt(0);
> This code was wroten at last line in onCreate(Bundle icicle),
> If I move this code out onCreate(Bundle icicle), move into a method which
> will be called only after onCreate finished, it works ok.
>
> seems it's not possible to get child before onCreate(Bundle icicle)
> finished.
>
> But what I need is to init list items with different heights, is there a way
> to do this before list view is shown?
>
> On Sun, Oct 12, 2008 at 6:33 PM, Romain Guy <[EMAIL PROTECTED]> wrote:
>
> > If you want the Views that represent the items on screen, use
> > ListView.getChildAt(). You can also look at getFirstVisiblePosition()
> > to match the Views with your adapter's content. For instance, the item
> > at position p in your adapter is represented by the View returned by
> > getChildAt(p - getFirstVisiblePosition()).
>
> > On Sun, Oct 12, 2008 at 3:23 AM, Guillaume Perrot
> > <[EMAIL PROTECTED]> wrote:
>
> > > The items in a list view are backed by a ListAdapter.
> > > You can retrieve the current adapter set on a list view by calling
> > > getAdapter().
>
> > > On Oct 11, 4:11 pm, plargo <[EMAIL PROTECTED]> wrote:
> > >> it's been bothering me for a while...
>
> > --
> > Romain Guy
> >www.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to