Maruf Hasan
Maruf Hasan

Reputation: 1

Why there is a space below my bottom navigation bar?

There is a big space below the bottom navigation icons. I am trying to solve it for a long time but cannot solve it.

Here is the markup:

<FrameLayout
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

    </FrameLayout>

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottomNavigationView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:menu="@menu/bottom_nav_menu" />

I want to solve it.

Upvotes: 0

Views: 499

Answers (2)

Afaz Uddin
Afaz Uddin

Reputation: 1

When I programmed the bottom navigation bar, I noticed that there are a lot of empty spaces below the bottom navigation bar. I tried slobbering it with properties many times to no avail, Some code chills with onCreate in Java solved when I removed them.

Removing these codes from here solved the problem.

    ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
        Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
        v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
        return insets;
    });

Upvotes: 0

jlsrmr
jlsrmr

Reputation: 1

removing this code from the java activity solved the problem for me

        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
        Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
        v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
        return insets;

    });

Upvotes: 0

Related Questions