Great,  the setLayout call what I was looking for.

Thank you.


On Dec 24, 10:22 am, Dianne Hackborn <[email protected]> wrote:
> It definitely works; after all, this is how activities are full-screen.
>
> If nothing else, you can just set the theme of your dialog to @style/Theme
> which will make it look and behave the same as a full-screen activity. ;)
>
> Be sure that you are setting this on the *window* not on the content view.
>  A WRAP_CHILD in a parent will cause its children to wrap as well; by
> default a dialog as WRAP_CHILD for the width and height of the entire
> window.  You change this with Dialog.getWindow().setLayout().
>
>
>
>
>
> On Thu, Dec 23, 2010 at 6:17 PM, Zsolt Vasvari <[email protected]> wrote:
> > Hi Dianne,
>
> > I have never been able to successfully make MATCH_PARENT work.  It
> > seems to work for making the width (but not the height) of a floating
> > Activity match the screen size, but I was never able to do the same
> > for an AlertDialog.
>
> > Here's an AlertDialog from my app using MATCH_PARENT for the
> > AlertDialog's content view.  No views inside have a specific size set:
> >http://picasaweb.google.com/zvasvari/ScreenWidth#5554064956779202578
>
> > As you can see, it's way too narrow for the screen and, of course,
> > it's even worse in landscape mode.
>
> > Now here's the same dialog if I give it a minWidth of 300dp, nicely
> > filling the screen.  This is on a Nexus One (480x800):
> >http://picasaweb.google.com/zvasvari/ScreenWidth#5554064961041980722
>
> > I've tried many-a-times in vain to make an AlertDialog expend to the
> > screen size, but so far, I've been unsuccessful without giving it a
> > minWidth.
>
> > Zsolt
>
> > On Dec 23, 3:44 pm, Dianne Hackborn <[email protected]> wrote:
> > > 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%2bunsubs­[email protected]>
> > <android-developers%2bunsubs­[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%2bunsubs­[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.- 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%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.- 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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to