Questions tagged [bottomnavigationview]

Questions related to bottom navigation bar. Bottom Navigation Bar menu item title,icon,populating content and and enabled states related issues. Bottom navigation bar item click listener, item background resource,item text color, inflate menu,max item count. Bottom Navigation Bar is an implementation of material design bottom navigation.

BottomNavigationView

BottomNavigationView Represents a standard bottom navigation bar for application. It is an implementation of material design bottom navigation.

Bottom navigation bars make it easy for users to explore and switch between top-level views in a single tap. It should be used when application has three to five top-level destinations.

The bar contents can be populated by specifying a menu resource file. Each menu item title, icon and enabled state will be used for displaying bottom navigation bar items. Menu items can also be used for programmatically selecting which destination is currently active.


                                         BottomNavigationView

This widget has a couple of attributes set on it. We can use these to set menu items we wish to display and the colours to be used throughout the Bottom Navigation View:

  • app:itemBackground — The background color to be used for the bottom navigation menu
  • app:itemIconTint — The tint to be used for the icons in the bottom navigation menu
  • app:itemTextColor — The color to be used for the text in the bottom navigation menu
  • app:menu — The menu resource to be used to display items in the bottom navigation menu

We can also set these values programmatically by using the following methods on our BottomNavigationView instance:

  • inflateMenu(int menuResource) — Inflate a menu for the bottom navigation view using a menu resource identifier.
  • setItemBackgroundResource(int backgroundResource) — The background to be used for the menu items.
  • setItemTextColor(ColorStateList colorStateList) — A ColorStateList used to color the text used for the menu items
  • setItemIconTintList(ColorStateList colorStateList) — A ColorStateList used to tint the icons used for the menu items

Useful Links:

1718 questions
20
votes
7 answers

How to programmatically select BottomNavigationBar Tab in Flutter instead of built in onTap callback?

I have been working with BottomNavigationBar in the flutter, but I am not able to select a Tab programmatically outside of onTap callback of BottomNavigationBar. The code with onTap callback, which is working: return new BottomNavigationBar( …
Harsh Sharma
  • 898
  • 1
  • 14
  • 30
19
votes
6 answers

How to implement new material BottomAppBar as BottomNavigationView

I was trying to implement the new BottomAppBar that usually looks like this: material BottomAppBar as a BottomNavigationView like in the Google home app that looks like this. My problem is that since I can fill the BottomAppBar only with a menu…
18
votes
6 answers

Bottom Navigation Bar: Text size is increasing on pressing?

I am using the Bottom Navigation Bar in Android. By default when I select an item the text size of the label of that item increases. As seen here by the 'tournaments' label. Is there a way to remove this so the word 'tournaments' stays the same…
Lewis Black
  • 957
  • 2
  • 8
  • 22
18
votes
5 answers

BottomNavigationView overlapping FrameLayout in CoordinatorLayout

The following is my layout xml. The problem now is that the BottomNavigationView is overlapping the FrameLayout. I wanted the FrameLayout to stretch to the top of the BottomNavigationView. I tried with trick such as adding paddingBottom in the…
hjchin
  • 864
  • 2
  • 8
  • 25
18
votes
2 answers

How to change text padding in android bottom navigation view

I am using the bottom navigation view for an android app. I have increased the size of my icon, but now the icon runs over the text. Here is what I see: Here is a diagram of the bottom navigation view according to google design docs: The number…
jjjjjjjj
  • 4,203
  • 11
  • 53
  • 72
18
votes
5 answers

How do I add elevation (shadow) to my BottomNavigationView. It doesn't come by default

I tried setting elevation from xml and programmatically both. But nothing works.
Javed Khatri
  • 719
  • 2
  • 7
  • 9
17
votes
3 answers

Android Navigation Component : BottomNavigationView's selected tab icon is not updated

I'm using BottomNavigationView with Navigation Component. When showing fragment is not root fragment, the tab icon is not updated (selected). Example: When I switch between Tab Home with Fragment A (which is root fragment) and Tab Star with Fragment…
Amir
  • 1,628
  • 20
  • 28
17
votes
5 answers

NavigationUI not working correctly with bottom navigation view implementation

So I have a scenario in which I have 5 fragments attached with bottom navigation. 1. Home 2. Inbox 3. Search 4. Notification 5. Profile So I have another fragment called (BarcodeDetail) to which I navigate from Home Fragment. (Home ->…
Malik Bilal
  • 869
  • 8
  • 25
17
votes
2 answers

BottomNavigationView inside a BottomAppBar with transparent background

I have been combining the new(ish) Material BottomAppBar with a standard BottomNavigationView. My xml is like this:
17
votes
4 answers

How to highlight the item when pressed using BottomNavigationView between activities?

I have added Bottom Navigation View for my app but I need the Bottom Navigation View between activities instead of fragment so I have added this code to Java for all my 3 activities. When I select Second or Third in my phone all things are correct…
17
votes
7 answers

Changing BottomNavigationView's Icon Size

I have been experimenting with the new BottomNavigationView and trying to customise it. So far I have managed to change the height and margins by using the below:
Steve Cortis
  • 522
  • 1
  • 6
  • 25
16
votes
1 answer

Hiding toolbar or bottomNavigationBar in Navigation Component

I followed guide from android.developers and implemented a navigation component into my app. I stumbled across a problem when I need some screens to be with or without a toolbar/bottom navbar. Android developers example's layout …
16
votes
5 answers

Bottom Navigation with fab

I am currently working with BottomNavigationView and FloatingActionButton. What i want to achieve is this below design: And what i have tried:
16
votes
4 answers

Bottom navigation bar is reloading all the widgets each time I press a navigation item

The following code is almost a copy-paste from the official flutter GitHub example for the bottom navigation bar. The problem is, at the opening of the widget containing the views, everything is preloaded. And each time I press a bottom bar element…
TheLetch
  • 375
  • 1
  • 4
  • 15
16
votes
2 answers

Android: remove shadow from bottom navigation

When placing a container below my bottom navigation, it is partly covered by the gray shadow from the navigation, even after adding content to the container. How do I remove the shadow?
tmbz
  • 163
  • 1
  • 4