How to customize the width and height when show an Activity as a Dialog

前端 未结 5 1133
时光取名叫无心
时光取名叫无心 2020-12-08 19:41

If I have defined a Activity:

public class DialogActivity extends Activity{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        supe         


        
5条回答
  •  佛祖请我去吃肉
    2020-12-08 20:28

    There's a one-line code without hassling with the LayoutParams that is

    getWindow().setLayout((int)(width*.8),(int)(height*.25));
    

    This is what I've used before in one of my projects and now searching for, but found it in the same project.

提交回复
热议问题