Vipul
Vipul

Reputation: 28103

center align icons in android BottomNavigationView

I am trying out newly released BottomNavigationView from android support library com.android.support:appcompat-v7:25.0.0

My assumption was menu icons will be center_vertial aligned if I don't setup menu titles but thats not happening. Below is sample screenshot.

enter image description here

Can someone point me in correct direction if its possible at all without rolling down and custom view? I am targeting following output.

enter image description here

Upvotes: 2

Views: 6023

Answers (4)

Rajat Das
Rajat Das

Reputation: 197

You can use app:labelVisibilityMode="unlabeled" to hide the labels this way the icons will be aligned to center

Upvotes: 2

Daniele
Daniele

Reputation: 1081

It's quite late, but you can add app:labelVisibilityMode="unlabeled" to your BottomNavigationView tag

Upvotes: 3

MJakhongir
MJakhongir

Reputation: 3028

You can use android:paddingTop="15dp" and use android:background="@color/colorPrimary" instead of app:itemBackground="@color/colorPrimary"

Or you can use Libs like https://github.com/ittianyu/BottomNavigationViewEx

Upvotes: 0

MohanadMohie
MohanadMohie

Reputation: 1044

The space below your images is the titles' space (Empty TextView). I believe that they currently don't support an image without a text. (MenuItem must have a title, else it throws an error in xml).

Upvotes: 1

Related Questions