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.

BottomBar space at top

See original GitHub issue

I´m using this library in my app and I love it, the main problem is that on some devices as Nexus 4 and 5, running Android 5.0 and 5.1 respectively, there is a space between the bottom bar and the FAB button, and I don´t know how to solve it. Screenshot I set up the bottom bar with:

bottomBar = BottomBar.attach(this, savedInstanceState);
        bottomBar.noTopOffset();

        bottomBar.setMaxFixedTabs(2); //Three fragments -1

        bottomBar.setItems(
                new BottomBarTab(R.drawable.ic_scale_bathroom, "Weight"),
                new BottomBarTab(R.drawable.ic_food, "Food"),
                new BottomBarTab(R.drawable.ic_user_settings, "User"),
                new BottomBarTab(R.drawable.ic_burnt_calories, "Exercise")
        );

        bottomBar.selectTabAtPosition(1, true);

        // Setting colors for different tabs when there's more than three of them.
        bottomBar.mapColorForTab(0, ContextCompat.getColor(this, R.color.weightTab));
        bottomBar.mapColorForTab(1, ContextCompat.getColor(this, R.color.foodTab));
        bottomBar.mapColorForTab(2, ContextCompat.getColor(this, R.color.userTab));
        bottomBar.mapColorForTab(3, ContextCompat.getColor(this, R.color.exerciseTab));

All the fragments are displayed on activity_main.xml whose code is:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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="com.javierd.iifym.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay"
        app:elevation="0dp">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

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

    <FrameLayout
        android:id="@+id/fragment_container"
        android:layout_marginTop="?attr/actionBarSize"
        android:layout_below="@+id/toolbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

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

And, for example the exercise fragment layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.javierd.iifym.MainActivity">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true">

        <android.support.design.widget.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp"
            android:layout_marginEnd="16dp"
            android:src="@drawable/ic_dialog_add"
            app:backgroundTint="@color/exerciseTabFAB"/>
    </LinearLayout>

</RelativeLayout>

Could somebody help me please? Thanks a lot!

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
BipinBhandaricommented, Jul 1, 2016

I solved this issue by setting mBottomBar.noNavBarGoodness();

like this

        mBottomBar = BottomBar.attach(this, savedInstanceState);

        mBottomBar.useOnlyStatusBarTopOffset();
        mBottomBar.noNavBarGoodness();
        mBottomBar.noTabletGoodness();

0reactions
mubarak1361commented, Sep 3, 2016

@Kiran89kumar set app:bb_showShadow=“false” in 2.+ version

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting unncessary space at the top of toolbar while adding ...
I am using https://github.com/roughike/BottomBar for bottom navigation. If I use bottom navigation with only 3 tabs than it works fine but if I...
Read more >
Bottom navigation - Material Design
Bottom navigation bars display three to five destinations at the bottom of a screen. Each destination is represented by an icon and an...
Read more >
SOLVED: Spacing toolbar elements – SwiftUI
I'm trying to lay out a bottomBar toolbar, but this is the only way I've been able to do it that spaces the...
Read more >
Material Components and layouts | Jetpack Compose
padding — to offset the top and bottom bars, if they exist. Scaffold(/* ... */) ...
Read more >
BottomNavigationBar class - material library - Dart API
The bottom navigation bar consists of multiple items in the form of text labels, icons, or both, laid out on top of a...
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