Show view out of layout border

115 views Asked by At

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?

3

There are 3 answers

0
Zain On BEST ANSWER

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.

0
George On

It would help to see your layout file, but you should be able to easily do that by putting both of the views in a Relative Layout and setting the footer to the bottom of the layout and making the fragment match the size of the relative layout container. That will make the footer overlap the fragment. And then just add an offset to the bottom padding to what you want in the fragment view

0
skafle On

I do not have your layout code. If your Fragment is in constantlayout then have your bottom of Fragment to constrained to bottom of the parent. Give your Fragment bottom margin that equals the height of your bottom navigation view. And finally, give some elevation to the bottom navigation view. That's should work.