Skip to content

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 #404

@Frizbi22

Description

@Frizbi22
   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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions