Discussion:
Dialog cannot fill whole screen
doubleslash
2009-07-31 14:33:40 UTC
Permalink
My dialog shows a relativelayout, which is set to fill_parent in both
width and height. However, it doesn't fill the whole screen. I tried
settting the window flags to full screen but that didn't help either.
Can someone tell me how to do this?
nEx.Software
2009-07-31 14:41:08 UTC
Permalink
Just out of curiosity, why are you using a dialog if you want it to
fill the screen? That being said, the content within the dialog will
push it to fill the screen if required. Putting things like ListViews
with fill_parent seems to do the trick...
Post by doubleslash
My dialog shows a relativelayout, which is set to fill_parent in both
width and height. However, it doesn't fill the whole screen. I tried
settting the window flags to full screen but that didn't help either.
Can someone tell me how to do this?
matthias
2009-09-01 14:18:04 UTC
Permalink
Hi, I am also trying to find a solution to this...
Post by nEx.Software
Just out of curiosity, why are you using a dialog if you want it to
fill the screen?
simply because there are occasions where you need to replace content
in the dialog dynamically and you don't want the dialog to resize but
remain at full width and height. For instance, I need to display
images of different width and height in the dialog, and I don't want
the dialog to change size with every image the user looks at.
Dianne Hackborn
2009-09-01 16:55:19 UTC
Permalink
The dialog theme, as part of its nature, sets the top-level window layout to
be WRAP_CONTENT. You could try manually setting the Window layout width and
height to FILL_PARENT, though this is going to make for a kind-of weird
dialog (especially if one day you find yourself running on a large
screen...).
Post by matthias
Hi, I am also trying to find a solution to this...
Post by nEx.Software
Just out of curiosity, why are you using a dialog if you want it to
fill the screen?
simply because there are occasions where you need to replace content
in the dialog dynamically and you don't want the dialog to resize but
remain at full width and height. For instance, I need to display
images of different width and height in the dialog, and I don't want
the dialog to change size with every image the user looks at.
--
Dianne Hackborn
Android framework engineer
***@android.com

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 android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers-***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---
matthias
2009-09-04 08:40:05 UTC
Permalink
Hi Dianne,

this is what I did, and it didn't work:

WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.width = WindowManager.LayoutParams.FILL_PARENT;
lp.height = WindowManager.LayoutParams.FILL_PARENT;
getWindow().setAttributes(lp);

that has no effect whatsoever (I called it in onCreate(), tried
calling it before and after the super.onCreate(), but no luck).

What I do now is implement a custom LinearLayout for the activity
where I override onMeasure() and set the width and height to the
screen width and height. But that's incorrect of course, because that
size is larger than the actual canvas (it doesn't account for menu and
toolbars).

Can you help me out here? Why is there no simple way to fix a dialog's
size?

Cheers,
Matthias
Post by Dianne Hackborn
The dialog theme, as part of its nature, sets the top-level window layout to
be WRAP_CONTENT.  You could try manually setting the Window layout width and
height to FILL_PARENT, though this is going to make for a kind-of weird
dialog (especially if one day you find yourself running on a large
screen...).
Post by matthias
Hi, I am also trying to find a solution to this...
Post by nEx.Software
Just out of curiosity, why are you using a dialog if you want it to
fill the screen?
simply because there are occasions where you need to replace content
in the dialog dynamically and you don't want the dialog to resize but
remain at full width and height. For instance, I need to display
images of different width and height in the dialog, and I don't want
the dialog to change size with every image the user looks at.
--
Dianne Hackborn
Android framework engineer
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.
Continue reading on narkive:
Loading...