카테고리 없음 / / 2020. 2. 4. 22:55

BottomsheetDialogFragment의 background touch시 자동 dismissal 되는 것을 막는 방법

https://stackoverflow.com/questions/42154321/prevent-dismissal-of-bottomsheetdialogfragment-on-touch-outside
override fun onCancel(dialog: DialogInterface) {

// val confirming: DialogFragment =
// m212_commentConfirm_dialogfragment(commentContextGuestbook, commentContextCommenter)
// confirming.setTargetFragment(this@m212_comment_bottomsheetdialogfragment
// , From_Guestbook_to_ReplyConfirming) //https://stackoverflow.com/questions/18025425/how-to-get-data-from-dialogfragment-to-a-fragment
// confirming.show(parentFragmentManager, "m212_comment_bottomsheetdialogfragment")

//dismiss()
}

override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
val touchOutsideView = dialog?.window?.decorView?.findViewById<View>(R.id.touch_outside)
touchOutsideView?.setOnClickListener(null)
}

 

Prevent dismissal of BottomSheetDialogFragment on touch outside

I have implemented a BottomSheet Dialog and I want to prevent the bottomsheet from dismissing when the user touches outside of the bottomsheet when it's peeking (Not fully expanded state). I have ...

stackoverflow.com

를 참고하였다

 

 

dialogFragment생성시

isCancelable = false 을 추가하면된다.

  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유
  • 카카오스토리 공유