How to make DialogFragment match_parent
I used to make dialog using DialogFragment.
However, match_parent which is value of layout_width and layout_height attribute is not working.
With hard work and effort, I found the solution.
override fun onResume() {
super.onResume()
val params = dialog?.window?.attributes //1
params?.width = ViewGroup.LayoutParams.MATCH_PARENT
params?.height = ViewGroup.LayoutParams.MATCH_PARENT
dialog?.window?.attributes = params as WindowManager.LayoutParams //2
dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) //3
}
1 => Get window's attributes and set LayoutParams' value
2=> Set LayoutParams to window's attributes
3=> Make dialog's background transparent