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

You must call setGraph() before calling getGraph()

I have bottom Navigation also I'm replaced the tag with FragmentContainerView it gives me error about it does not have a NavController set on, then i was posted this question and fixed the problem, but I got this below error when…
15
votes
0 answers

How can i get the height of BottomNavigationView using XML?

Is there any way to get the height of BottomNavigationViewheight using XML attribute just like this ?attr/actionBarSize
Manoj Perumarath
  • 9,337
  • 8
  • 56
  • 77
15
votes
3 answers

Bottom Navigation bar moves up with keyboard

I am using scroll view in a fragment but the screen does not scroll up when the keyboard is shown as it should be. Here is the scenario: I have mainActivity which has bottom navigation bar plus a frame layout which works as container for the…
Haroon khan
  • 1,018
  • 2
  • 15
  • 27
15
votes
6 answers

How to show menu item icon without tint color in BottomNavigationView

I have created a BottomNavigationView with three items. One of it was user tab. For the guest tab, there is an image but the TintColor is applying and we can't see that. So how to remove tint colour for that particular item? I have tried if…
noobEinstien
  • 3,147
  • 4
  • 24
  • 42
14
votes
4 answers

Animation for BottomNavigation Fragments with Architecture Navigation Components

I have successfully integrated the bottom navigation with the latest android architecture navigation components. The following is my complete code. Navigation
14
votes
2 answers

State of nested Fragments is lost when returned to same tab in 'Navigation Architecture Component'

I'm exploring the the 'Navigation Architecture Component' concept which introduced in Google I/O 2018 last month. Let say I have an activity with a bottom navigation view and a 'fragment' to host all…
14
votes
6 answers

How to disable BottomNavigationView click and Touch?

i want to implement behavior on certain condition the bottom view is unable to click, i want to make if bottom view item being click it does not navigate to that item but still stay at the current item
14
votes
2 answers

Why does Android BottomNavigationView not show up?

I am using the new Android BottomNavigationView but the bottom navigation MenuItem action view is not showing. After debugging I found that the menu item is not null and the visibility is visible. After checking height and width of the root view…
user007
  • 421
  • 1
  • 4
  • 7
14
votes
2 answers

Show/hide BottomNavigationView on scroll in CoordinatorLayout with AppBarLayout

I am trying to use both AppBarLayout and BottomNavigationLayout in a single CoordinatorLayout and I'm having difficulties hiding the BottomNavigationLayout as required by the material guideline. I mean something like…
13
votes
4 answers

BottomNavigationBar underneath NavBar

The Goal: 1) Make the status bar transparent - Done 2) Make the BottomNavigationView and the Navbar the same color. - Almost Done The Problem By adding the following code in my Activity, the status bar becomes transparent. BUT, BottomNavigationView…
Subby
  • 5,370
  • 15
  • 70
  • 125
13
votes
4 answers

Disappearing fab icon on navigation fragment change

I have a bottom navigation view with 3 items which navigate to 3 different fragments (fragments are created only once and their instances are saved in mainactivity's onSavedInstanceState()) and on top of it a floating action button. We want to…
13
votes
4 answers

Flutter update BottomNavigationBar

I am using a BottomNavigationBar together with a TabController. By clicking on the different Tabs of the BottomNavigationBar the TabView is changing the content. However if I swipe on the TabView to switch to another view/tab the BottomNavigationBar…
Ben
  • 650
  • 2
  • 12
  • 23
13
votes
10 answers

Set no item pre-selected in Bottom Navigation view

I'm adding the new Bottom Navigation View from the material design library to a project, and I would like to have no pre selected item by default. For now first item is selected by default. I have used…
MRX
  • 1,400
  • 3
  • 12
  • 32
13
votes
2 answers

FloatingActionButton with BottomNavigationView

I cant position my FAB. It should be bottom right, but on top of the BottonNavigationView. 1) Can i achieve this without RelativeLayout inside coordinateLayout? 2) Show me how 3) Should i use FrameLayout as a container for…
Xmstr
  • 229
  • 4
  • 12
13
votes
1 answer

Android BottomNavigationView items showing without text also layout does not hiding on scroll

Hello Guys I have implemented design library BottomNavigationView. Its works perfectly but I don't know why my menu icon are not showing with text also I want it to hide with scroll down such as Floating Action Button. But I didn't find any way to…
Abhishek Singh
  • 9,008
  • 5
  • 28
  • 53