Search code examples
androidviewgroup

Show view out of layout border


I have created custom bottom navigation view in separate layout.

enter image description here

What I want is to achieve this:

enter image description here

Instead of this (in red is the bottom navigation layout border):

enter image description here

Is there a tricky way to achieve this?


Solution

  • Is there a tricky way to achieve this?

    Yes:

    Layout scheme:

    <ConstraintLayout>
        <Fragment>
        <BottomLayout>
        <Guideline>
    </ConstraintLayout>
    
    • The Guideline is horizontal & should have the same height as the BottomNavView
    • Fragment has a bottom constraints to the top of the Guideline
    • The CoordinatorLayout of the BottomLayout should have a transparent background in order to show the fragment on the background

    The downside is that the touch events on the intersection area of the BottomLayout with the Fragment will be intercepted by the BottomLayout.