This below answer works for me in fragment dialog. Dialog dialog = getDialog(); if (dialog != null) { int width = ViewGroup.LayoutParams.MATCH_PARENT; int height = ViewGroup.LayoutParams.MATCH_PARENT; dialog.getWindow().setLayout(width, height); }
override fun onStart() { super.onStart() dialog?.let { val width = ViewGroup.LayoutParams.MATCH_PARENT val height = ViewGroup.LayoutParams.MATCH_PARENT it.window?.setLayout(width, height) } }