Try to search your question here, if you can't find : Ask Any Question Now ?

BottomSheetDialogFragment allow user to touch outside

HomeCategory: stackoverflowBottomSheetDialogFragment allow user to touch outside
Avatarrupesh asked 4 months ago

I’m trying to launch a BottomSheetDialogFragment from list of videos, once opened, a video will play, however I want to allow the user to select other videos from the list while the BottomSheetDialogFragment is open.

What I tried:

   <style name="CustomBottomSheetDialogTheme" parent="Theme.Design.Light.BottomSheetDialog">
    <item name="bottomSheetStyle">@style/CustomBottomSheetStyle</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:colorBackground">@android:color/transparent</item>
    <item name="android:backgroundDimEnabled">false</item>
    <item name="android:backgroundDimAmount">0</item>
    <item name="android:windowFrame">@null</item>
    <item name="android:windowIsFloating">true</item>
</style>

<style name="CustomBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
    <item name="android:background">@android:color/transparent</item>
</style>

and:

    @SuppressLint("RestrictedApi")
override fun setupDialog(dialog: Dialog?, style: Int) {
    super.setupDialog(dialog, style)
    dialog?.window?.setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)
    dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
    dialog?.setCanceledOnTouchOutside(false)
    dialog?.setCancelable(false)
}

All the above works in a DialogFragment but does not in a BottomSheetDialogFragment.

1 Answers
Best Answer
AvatarArben answered 4 months ago
Your Answer

12 + 8 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com