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
25
votes
3 answers

How to pass arguments to a fragment using bottom navigation view and Android Navigation component?

Is it possible to pass and access arguments in a fragment using a bottom navigation view and the Navigation component? I'm using a one activity with many fragments approach where my top level fragment requires an argument(Usually done via the…
25
votes
7 answers

How to increase icon size in android bottom navigation layout?

I am using the bottom layout navigation style in android that was recently introduced by google in design library 25. In all the tutorials and questions i see, the images in their icons are a normal size, but mine are extra small, despite the fact…
jjjjjjjj
  • 4,203
  • 11
  • 53
  • 72
25
votes
5 answers

BottomNavigationBar-change the tab icon color

I've integrated Bottom Bar Navigation bar on my app. But when I swipe, tab's color doesn't change. It's weird cause I have selector file. Any idea to solve this problem? Activity.java BottomNavigationView bottomNavigationView =…
Yunus Haznedar
  • 1,584
  • 4
  • 23
  • 33
25
votes
4 answers

BottomNavigationView - How to get selected menu item?

I used BottomNavigationView to switch fragments. How to get currently selected menu item, to prevent reopening fragment ? BottomNavigationView bottomNavigationView = (BottomNavigationView) …
phnmnn
  • 12,813
  • 11
  • 47
  • 64
24
votes
2 answers

BottomNavigationView using androidx

I have created some app and I had like to insert to it a BottomNavigationView. The code worked perfectly however once I changed at my gradle to androidx it stopped working. The component in my layout…
24
votes
6 answers

Restoring fragment state when changing fragments through bottom navigation bar

I have bottom navigation bar on click of item in navigation bar i am replacing fragments. I have 3 fragments A,B,C so on click of b item B fragment is loaded and in B i am calling 3-4 APIs. So now if i go to C and then again come to B a new instance…
24
votes
10 answers

BottomNavigationView - Shadow and Ripple Effect

I was really happy when BottomNavigationView was released one week ago but I am facing some problems which makes me unable to solve it, like to see a shadow over the BottomNavigationView, on the same way as Google Photos Android App shows us: If we…
Filipe Brito
  • 5,329
  • 5
  • 32
  • 42
23
votes
5 answers

How to increase Bottom Navigation View height along with its icon and text sizes in android?

I am using compile 'com.android.support:design:25.0.0' Android Bottom Navigation View and its height is is fixed and tiny icons with small text are shown. My question is how can i increase their sizes? I've tried to change size in xml file through…
Ramsha Omer
  • 1,022
  • 1
  • 8
  • 28
23
votes
9 answers

Recyclerview covered by BottomNavigationView in CoordinatorLayout

I tried Google Support Library BottomNavigationView with a Framelayout for my Fragments . Here are my code
22
votes
13 answers

React native bottom tab bar pushing itself up when opening keyboard

We are using createBottomTabNavigator. In one of the tab contains search bar at the top. While clicking on that search bar, we are opening the keyboard. But the keyboard pushing up the bottom tab bar also. We need the bottom tab bar remains at the…
Dhevendhiran M
  • 994
  • 2
  • 12
  • 29
22
votes
4 answers

Side Navigation Drawer Item click not working

PLEASE READ FIRST BEFORE ANYONE MARK IT AS DUPLICATE QUESTION BECAUSE IT IS NOT. I have used Navigation Drawer, Bottom Navigation bar and a custom Action bar. Bottom navigation bar and action bar are working fine. navigation drawer also shows menu…
22
votes
7 answers

CoordinatorLayout content child overlaps BottomNavigationView

I'm trying to use a CoordinatorLayout with a BottomNavigationView, an AppBarLayout, and a ViewPager. Here is my layout:
Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
22
votes
5 answers

Separate Back Stack for each tab in BottomNavigationView Android using Fragments

I'm implementing BottomNavigationView for navigation in an Android app. I am using Fragments to set the content for each tab. I know how to set up one fragment for each tab and then switch fragments when a tab is clicked. But how can I have a…
21
votes
1 answer

Android BottomNavigationView unselected text not showing

I am using android.support.design.widget.BottomNavigationView. All is fine except the titles not showing when not selected.
Sean
  • 2,967
  • 2
  • 29
  • 39
20
votes
6 answers

How to change the icon color selected on bottom navigation bar in android studio

When I select an item in bottom navigation bar in android studio, background item selected is equal to primarycolor in values->colors.xml . and now I want to change this color which is not to same the primarycolor. how do i can to change it? …
Hasan Cheraghi
  • 867
  • 2
  • 11
  • 26