This is 500dp in the tall dimension?  The two screens have different aspect
ratios, so the tall/wide dimensions are different.  The scaling factor
between mdpi (160) and hdpi (240) is 1.5.  800 / 1.5 == 533.  480 * 1.5 ==
720.

(And of course those aren't the only aspect ratios.  QVGA is even shorter
(that is why it is a small screen), while some devices like droid are taller
at 480 x 852.)

If you want to fill the screen, the easiest way to do this is to just make
your window's layout in that dimension be MATCH_PARENT.  If you aren't using
MATCH_PARENT, your layout should be computing the size it needs based on its
content and using that, not trying to impose numbers to match the screen.

(There is another level of complexity here when moving to significantly
larger screens.  The phone screens are relatively simple, in that just
allowing the dialog fill the available width if it could at all use it ends
up working well.  On an xlarge screen, though, that looks ridiculous.
 Honeycomb should have some help for this problem...)

On Wed, Dec 22, 2010 at 11:33 PM, Zsolt Vasvari <[email protected]> wrote:

> Thanks, Dianne.  I am now just retrieving an int from 0 - 100 and
> divide it by 100 and set it as the weight.  It works fine, but it's
> just extra code and I am lazy person, which is why I asked. :)
>
> On a related question:
>
> I am defining the width of my pop-up window as 500dp, this fits nicely
> into my HDPI screen on my Nexus One (480x800), but the same 500dp on
> an MDPI device (320x480) is wider than the screen and I need to set
> the width to 460dp.  I would have thought using DIP as the unit of
> measure would deal with this.
>
> Thanks,
> Tom
>
> On Dec 23, 9:41 am, Dianne Hackborn <[email protected]> wrote:
> > Oh also you can just do a percentage dimension ("50%") and retrieve it
> with
> > a base value of 1 or 100 as desired.
> >
> > On Wed, Dec 22, 2010 at 5:40 PM, Dianne Hackborn <[email protected]
> >wrote:
> >
> >
> >
> >
> >
> > > You can use them as attributes, but unfortunately right now there is no
> way
> > > to get them as direct resources.
> >
> > > Well you can probably do it by being tricky -- use <item> to define a
> raw
> > > resource, and Resources.getValue() to retrieve its value.
> >
> > > (One reason why this doesn't exist is if it made entries in R. for
> float
> > > values it would create code that can't compile since "float" is a
> keyboard.
> > > :p  I solved that with ints by calling them integers, and booleans by
> > > calling them bools, but we never really needed floats so I never tried
> to
> > > come up with something to call them.)
> >
> > > On Wed, Dec 22, 2010 at 5:04 PM, Zsolt Vasvari <[email protected]>
> wrote:
> >
> > >> Am I missing something or there is no mechanism to define a float
> > >> value as a resource?
> >
> > >> I am trying to have a locale dependent weight added to some of my
> > >> buttons.  Right now, as a workaround, I am defining the weight as an
> > >> Integer and then divide and manualy set it.  But why would there be
> > >> such a seemingly arbitrary decision made as not to allow floats but
> > >> allow ints?
> >
> > >> --
> > >> 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]<android-developers%[email protected]>
> <android-developers%2bunsubsĀ­[email protected]>
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > 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.
> >
> > --
> > 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.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



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