How to customize the width and height when show an Activity as a Dialog
I finally figured out one way to customize the size of my DialogActivity
.
That's inside the onCreate()
method of DialogActivity
, add the following code:
WindowManager.LayoutParams params = getWindow().getAttributes();
params.x = -20;
params.height = 100;
params.width = 550;
params.y = -10;
this.getWindow().setAttributes(params);
You can just change params of window in your acctivity like:
override fun onStart() {
super.onStart()
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
}