XF AbsoluteLayout Z-Order Issue

DemiVisionDemiVision USMember ✭✭

I'm experiencing a bizarre z-order problem with XF AbsoluteLayout on Android. I have a drawer that slides in from the side of the screen. It's added last to the layout to (supposedly) ensure top of z-order. That works fine on iOS, however on Android it slides in behind one (and only one) of the other views in the layout. I have tried RaiseChild on the drawer and LowerChild on that one view. I have tried with and without the TranslateTo animation for the drawer. I have tried different orderings of Adding views to the layout. Nothing works. And I am not sure why it is behind just that one view out of several views on the screen. I'm stumped. Any ideas?

Thanks in advance!

Posts

  • NMackayNMackay GBInsider, University mod

    @DemiVision said:
    I'm experiencing a bizarre z-order problem with XF AbsoluteLayout on Android. I have a drawer that slides in from the side of the screen. It's added last to the layout to (supposedly) ensure top of z-order. That works fine on iOS, however on Android it slides in behind one (and only one) of the other views in the layout. I have tried RaiseChild on the drawer and LowerChild on that one view. I have tried with and without the TranslateTo animation for the drawer. I have tried different orderings of Adding views to the layout. Nothing works. And I am not sure why it is behind just that one view out of several views on the screen. I'm stumped. Any ideas?

    Thanks in advance!

    Not sure is this helps but Forms has some build in capabilities for ZOrder in Android
    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/android/visualelement-elevation

  • DemiVisionDemiVision USMember ✭✭

    I hadn't really messed with platform specifics much (I still do custom renderers), but VisualElement.Elevation worked like a charm. Thanks!!

  • NMackayNMackay GBInsider, University mod

    @DemiVision said:
    I hadn't really messed with platform specifics much (I still do custom renderers), but VisualElement.Elevation worked like a charm. Thanks!!

    Platform Specifics is very good now B)

  • lucidBrotlucidBrot Member ✭✭
    edited April 15

    This should not be necessary. Weird fix but ok.


    For me, the resulting shadow from the elevation is not fitting for my use case. As a workaround, nesting the Absolute layout within another layout did the trick. I do not know why, but it works.

    My View Tree now looks like this:

    Absolute Layout {
        Absolute Layout {
            Frame below
        }
       BoxView above
    }
    
Sign In or Register to comment.