Thanks, very helpful info.  I'll take it under advisement.

Cheers!

On Dec 9, 11:54 am, Ian <[EMAIL PROTECTED]> wrote:
> Hi Keith,
>
> Yes, it's a little tricky.  And I certainly don't consider the docs to
> be thorough.... more of a work in progress.
>
> Anyhow, the deal is that layout of the contents of a window happens
> *after* all the elements are constructed and added to their parent
> views.  It has to be this way, because until you know what components
> a View contains, and what they contain, and so on, there's no sensible
> way you can lay it out.
>
> Bottom line, if you call getWidth() etc. in a constructor, it will
> return zero.  The procedure is to create all your view elements in the
> constructor, then wait for your View's onSizeChanged() method to be
> called -- that's when you first find out your real size, so that's
> when you set up the sizes of your GUI elements.
>
> Be aware too that onSizeChanged() is sometimes called with parameters
> of zero -- check for this case, and return immediately (so you don't
> get a divide by zero when calculating your layout, etc.).  Some time
> later it will be called with the real values.
>
> Cheers,
>
> Ian
--~--~---------~--~----~------------~-------~--~----~
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