Android: Is there any way to allow touching outside the BottomSheet without closing the bottomsheet! Is it possible to behave like standard sheet and not like a modal sheet
Frizbi22 opened this issue · 2 comments
Frizbi22 commented
I have tried this but no luck!!
var bottomSheetDialog = new BottomSheetDialog(Platform.CurrentActivity?.Window?.DecorView.FindViewById(Android.Resource.Id.Content)?.Context ?? throw new InvalidOperationException("Context is null"));
bottomSheetDialog.SetContentView(bottomSheetContent.ToPlatform(page.Handler?.MauiContext ?? throw new Exception("MauiContext is null")));
// Allow touches on the underlying page
bottomSheetDialog.Window?.ClearFlags(WindowManagerFlags.NotTouchable);
bottomSheetDialog.Window?.ClearFlags(WindowManagerFlags.DimBehind);
bottomSheetDialog.Window?.ClearFlags(WindowManagerFlags.NotFocusable);
// Set the behavior of the bottom sheet
bottomSheetDialog.Behavior.Hideable = true;
bottomSheetDialog.Behavior.FitToContents = true;
bottomSheetDialog.SetCancelable(true);
bottomSheetDialog.Behavior.HalfExpandedRatio = 0.5f;
bottomSheetDialog.Show();
return bottomSheetDialog;
on iOS is working as intended when using medium or large detents!
VladislavAntonyuk commented
Probably this flag should be false: bottomSheetDialog.Behavior.Hideable
Frizbi22 commented
I have tried that but bottomSheetDialog.Behavior.Hideable is a property that determines whether the bottom sheet is responsive to drag gestures. Sadly i found no solution for it