atom feed2 messages in Dialog Size and Location
FromSent OnAttachments
wrightjmfJan 15, 2008 11:35 am 
hackbodJan 15, 2008 11:40 pm 
Subject:Re: Dialog Size and Location
From:hackbod (
Date:Jan 15, 2008 11:40:44 pm

You can call getWindow().getAttributes() to retrieve the WindowManager.LayoutParams for the window. This has the following fields involving window placement:

After making your desired changes, use getWindow().setAttributes() to install the new values.

Note that, though you can force a specific size through the width and height fields, in general the correct way to do this is let the window do its normal layout and determine the window size automatically that way. If you have a single view in the dialog that wants a fixed size such as 300x200, implement View.onMeasure() to call setMeasuredDimension(300, 200). Then when the view hierarchy layout happens, the dialog window will be given a size that ensures your view is that dimension (probably making the actual window larger to take into account the dialog frame and decoration).,%20int)

On Jan 15, 11:35 am, wrightjmf <> wrote:

Can anyone tell me how to change the size and location of a dialog box? I have created an activity with its theme attribute set to "@android:style/Theme.Dialog", but I can't figure out how to change the size and location of the resulting dialog.

Any help is appreciated.