Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove padding for icons in bottom navigation view

I'm trying to make the icons in a bottom navigation view lower. For example, right now they are pressed against the top line like this.

See image here

How would I make the icon lower? I want them to be centered vertically in the bottom navigation view.

xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.jchousurface.mastertrack.homescreen">

<FrameLayout
    android:id="@+id/content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1">
</FrameLayout>

<android.support.design.widget.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:background="#FFFFFF"
    app:menu="@menu/navigation" />

</LinearLayout>
like image 561
Jeffrey Chou Avatar asked Jul 01 '17 02:07

Jeffrey Chou


People also ask

How do I adjust the navigation bar at the bottom?

To create a Menu Resource File , click on the app -> res -> menu(right-click) -> New -> Menu Resource File and name it bottom_nav_menu. Now the user can create as many items as he wants in the bottom_nav_menu. xml file. The user also needs to create an icon for each of these items.

How do I hide the bottom of my navigation?

On Android 4.1 and higher, you can set your application's content to appear behind the navigation bar, so that the content doesn't resize as the navigation bar hides and shows. To do this, use SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION .


1 Answers

use

bottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED);

or

app:labelVisibilityMode="unlabeled"
like image 114
UgAr0FF Avatar answered Nov 08 '22 19:11

UgAr0FF