It's not a hack, its telling the linear layout to do the kind of stuff that
it does: reserve no space for that view (height=0), but give it all
remaining space (weight=1 and all other views left with the default
weight=0).
And yes, this is a typical way of building a UI that can deal with different
sizes (if you don't already have a list view or some other scrollable
container with the bulk of the data).  And it's not just different screen
sizes: it allows you to resize your UI when the soft keyboard is displayed,
when switching between landscape and portrait, etc.  A good example to look
at is the contacts edit screen.

As of 1.6, there will also be new layouts for different screen sizes, but
you need to avoid relying on this for resizing because there is not one
resource for every possible size, and even with similar screen sizes being
combined the sheer number you would need to do is overwhelming:

layout-small
layout-small-land
layout-normal
layout-normal-long
layout-normal-land
layout-normal-long-land
layout-large
layout-large-long
layout-large-land
layout-large-long-land

On Thu, Sep 17, 2009 at 3:16 AM, Mihai Dumitrache <[email protected]> wrote:

>
> Hello,
> Thanks. I don't know if this is a hack (it looks like at least for
> me), but it's cool.
> I would ask you if this is how you really build you layout on
> android ? using scrollview for stretching views on different screen
> sizes, or is there some official guidelines to follow.
> Is there some kind of way to create custom layouts for different
> screen sizes(qvga, hvga), just like layout and layout-land folders ?
>
> Thanks again.
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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