How to get dialog size?

前端 未结 4 634
情书的邮戳
情书的邮戳 2020-12-20 12:58

I am looking for a way to get size of a custom dialog. I went through this question, but the only answer given is pretty useless, because if I try mDialog.getWindow().

4条回答
  •  生来不讨喜
    2020-12-20 13:32

    Actually, in Android it doesn't work like in iOS - you can't get the size of the View itself, what you can do, though, is to ask for the size of the ROOT layout of that view.

    e.g.:

    myDialog.this.findViewById(R.id.dialog_root_layout).getHeight());

提交回复
热议问题