How to Dialogfragment disable click outside on android?
For your requirement, you should use setCancelable(true)
.
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
Kotlin overide onCreateDialog in your DialogFragment
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState)
dialog.setCancelable(false)
dialog.setCanceledOnTouchOutside(false)
return dialog
}