Forum Xamarin.Forms

Can I Display a View as an Overlay for the Full Screen, Including Over Navigation Pages?

I need to display an arbitrary view with full descendants as an overlay covering the full screen.

I've approximated this at the Page level, where I set the Content to be an Absolute Layout that contains what would otherwise be set to the Page's Content property as its first child, using proportional sizing, to cover the full width and height of the page area. I display my overlay view as a second child, similarly positioned, which acts as a container for whatever view I want to display on the screen. I use Animation methods to animate the view's appearance and disappearance.

This works wholly using Forms with no custom renderers, which is desirable as this is a cross-platform app.

I am satisfied with the above implementation, except when a Navigation Page stack is involved or otherwise when the navigation bar is displayed. My overlay only covers the Page area, which does not include the navigation bar. This allows the user the interact with any buttons in the navigation bar while the overlay is displayed, which is not desirable, as the overlay is being used to display modal content which should be dismissed before interacting with other elements.

I would greatly appreciate any insights or suggestions.


Best Answer


  • OliverArkKurekOliverArkKurek USMember

    I was afraid that might be the case. I've poked around the class structures a bit to see if I could slip something in, but it's unclear that's going on where under the covers. Do you have any suggestions or resources that might give me a starting point?

  • adamkempadamkemp USInsider, Developer Group Leader mod

    How you do this depends heavily on what you are actually trying to do. In general, though, on iOS you can just create a view and put it in the top-level window (filling the screen). On Android you need a PopupWindow in order to be able to overlap the activity bar.

  • DH_HA1DH_HA1 USMember ✭✭✭

    @adamkemp this would be a good case for a custom control

  • HosseinKarimyHosseinKarimy USMember

    @OliverArkKurek did you find any solution?

  • BlueRajaBlueRaja USMember ✭✭
    edited April 3

    It's unfortunate Xamarin doesn't provide a <FullscreenLayout> or something for this common scenario

Sign In or Register to comment.