I have make a custom dialog but it doesn't work as what i expect, been looking through other answer in stack overflow here is my method
val mDialogView =
LayoutInflater.from(mFragment.requireContext()).inflate(
R.layout.dialog_confirm,
null
)
val mBuilder = AlertDialog.Builder(mFragment.requireContext(),R.style.CustomDialog).setView(mDialogView)
val mAlertDialog = mBuilder.show()
mAlertDialog.setCanceledOnTouchOutside(false)
mAlertDialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
val dialogBinding = DialogConfirmBinding.bind(mDialogView)
and the result: picture1
i did found a answer work for me but i have no idea to combine with view binding
val dialog = Dialog(mFragment.requireContext())
dialog.setContentView(R.layout.dialog_confirm)
dialog.window!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
dialog.setCanceledOnTouchOutside(false)
dialog.show()
result that work for me: picture2
but even i setContentView(dialogbinding.root) the result will back to the first picture.