Ben Pearce
Ben Pearce

Reputation: 7094

Setting Dialog Size Programmatically

In my program I create a dialog with the code below. Ideally I would like to scale the dialog by entering width and height parameter programmatically. Can anyone show me how to do this?

dialog = new Dialog(MainActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
popUpLayout = Globals.layoutInflater.inflate(R.layout.pop_up_layout, null);
dialog.setContentView(popUpLayout);
dialog.show();

Upvotes: 15

Views: 24489

Answers (1)

Ben Pearce
Ben Pearce

Reputation: 7094

Here is the code that ended up working:

dialog.getWindow().setLayout(275, 350);

Upvotes: 40

Related Questions