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
13
votes
4 answers

Badge on BottomNavigationView

I am trying to add a badge to the BottomNavigationView Item without using any library, however somehow the BottomNavigationView is not showing the badge (custom_view) main_view.xml:
12
votes
0 answers

updateAcquireFence: Did not find frame

I am getting this error while switching to the last fragment of the bottom navigation and because of this the last fragment loads a little bit slow E/FrameEvents: updateAcquireFence: Did not find frame. 2022-01-03 12:35:41.373…
12
votes
3 answers

How to combine BottomNavigationView and ViewPager?

I need help to combine ViewPager and BottomNavigationView. But when I swipe the screen as ViewPager works, the fragment become stacked with another fragment. How do I fix this? Stacked fragment On normal fragment before swiped Here is my code…
12
votes
3 answers
12
votes
4 answers

Remove bottom navigation view text in android

I use bottom navigation view for my app and want to remove the text under the icon. I looked for it on the internet but still can't find the solution. Did anyone use to deal with this please give me your solution. All i want is like this: My code…
Luan Si Ho
  • 1,438
  • 2
  • 13
  • 17
12
votes
3 answers

Android XML FrameLayout and BottomNavigationView

How can I make the FrameLayout end with the beginning of the BottomNavigationView? The content of the FrameLayout is being overlapped by the navigation view. This is the xml:
Julian
  • 146
  • 2
  • 9
12
votes
3 answers

Android - how to get height of bottomnavigationview

I create a bottom navigation view. I try to get height of bottom navigation view. Material design says that the height should be 56dp. I don't want to use hard coded value, because I am not sure that this value won't change. How can I get the…
user2362956
12
votes
4 answers

Is there a way to have different icon/color for selected state of Android's BottomNavigationView?

The following is the XML for my current BottomNavigationView. Currently, all three of the icon drawables are unfilled icons with the same color. I would like be able to present a filled in version of the icon when that state is selected as well as…
Jason Fel
  • 921
  • 4
  • 10
  • 29
11
votes
2 answers

How to navigate with nested navGraph and bottom navigation view

I've bottom nav view with 3 item, My navGraph looks like this:
11
votes
2 answers

Flutter Bottom Navigation Bar with PageView

I want to build bottom navigation bar with a pageview. It will be 3 pages and you can transition left or right. I can slide but my navigation bar selected items color doesn't change. Can you help me? class HomePage extends StatefulWidget…
11
votes
2 answers

Android Jetpack Navigation proper back stack with BottomNavigationView

OBS: Though still no first class support (as of writing this), Google has now updated their samples with an example of how they think this should be solved:…
11
votes
2 answers

BottomNavigation style

I have BottomNavigationView
faq700
  • 111
  • 1
  • 1
  • 3
11
votes
0 answers

Android - How to add item to bottom navigation bar

I create a bottom navigation bar. I create a menu.xml under res. I add BottomNavigation to main layout.
user2362956
11
votes
3 answers

How to add dividers in Bottom Navigation View

I'm trying to add divider in menu items of BottomNavigationView All items are showing horizontally in the bottom but I'm not able to add dividers into it. Bottom Navigation View xml:
Anshul Tyagi
  • 2,076
  • 4
  • 34
  • 65