개발일지

삽질 - Android Dialog match_parent 본문

삽질

삽질 - Android Dialog match_parent

강태종 2021. 2. 8. 23:12

안드로이드에서 Dialog를 Custom해서 만들 때 layout_width와 layout_height를 match_parent로 해도 꽉 차지 않는데 이는 Dialog의 window가 wrap_content이기 때문이다. => window의 크기를 바꾸면 된다.

window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)

반드시 setContentView를 호출한 다음 바꿔야한다.

Comments