question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bottom bar falls to low behind the navigation bar

See original GitHub issue

I’m sure I did something wrong but I can’t figure out what.

I have this XML:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    android:id="@+id/main_coordinator_layout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".app.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:animateLayoutChanges="true"
        android:fitsSystemWindows="true">
...
    </android.support.design.widget.AppBarLayout>

    <FrameLayout
        android:id="@+id/main_fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

    <android.support.design.widget.FloatingActionButton ... />

</android.support.design.widget.CoordinatorLayout>

This is the code I use:

CoordinatorLayout coordinatorLayout = (CoordinatorLayout) findViewById(R.id.main_coordinator_layout);
mBottomBar = BottomBar.attachShy(coordinatorLayout, findViewById(R.id.main_fragment_container), savedInstanceState);
final OnMenuTabClickListener listener = new OnMenuTabClickListener() {
    @Override
    public void onMenuTabSelected(@IdRes int menuItemId) {
        displayFragment(menuItemId, null);
    }

    @Override
    public void onMenuTabReSelected(@IdRes int menuItemId) {
        // The user reselected item number one, scroll your content to top.
    }
};
mBottomBar.setItemsFromMenu(R.menu.bottom_tab_bar, listener);

mBottomBar.mapColorForTab(0, ContextCompat.getColor(this, R.color.colorAccent));
mBottomBar.mapColorForTab(1, 0xFF5D4037);
mBottomBar.mapColorForTab(2, "#7B1FA2");
mBottomBar.mapColorForTab(3, "#FF5252");

This is the result I get:

result screenshot

I have tried all combinations of noTopOffset, noNavBarGoodness, fitsSystemWindows… I can’t get the bottom bar to be:

  • shy
  • over the transparent navigation bar

Note that this has been taken with a Nexus 5X running N.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:33 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
neryortezcommented, Jun 1, 2016

No, @BenoitDuffez, you can always use your FrameLayout as always, just inside the NestedScrollView. So inside onMenuTabReSelected() you can get hold of thr FrameLayout and use a FragmentTransaction to replace the content of your FrameLayout (I think that’s what you already have on your display fragment() function)

Does it make it clearer?

0reactions
ognev-zaircommented, Oct 19, 2016

Try to use the latest version (currently 2.0.2) In this version this bug was fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Bottom bar falls to low behind the navigation bar
I search about this and finally i got it why this bottom navigation show under the bottom bar. i remove below Flag in...
Read more >
Lower part of a window hidden behind the taskbar
Hello everyone, I have been searching for a solution but to no avail. I couldn't figure it out myself and couldn't find the...
Read more >
Why is my navbar behind other content? - HTML-CSS
I've created a navbar that sits on the top of my portfolio website. ... with a larger z-index generally covers an element with...
Read more >
How To Shrink a Navigation Menu on Scroll - W3Schools
This example demonstrates how to shrink a navigation bar when the user starts to scroll the page. Scroll down this frame to see...
Read more >
Bottom navigation bar in mobile apps: Here's all you need to ...
Bottom navigation bar aligns with the “thumb rule of design”. It works on the principle, that most app users scroll and navigate apps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found