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

Android clear backstack when leaving item tab BottomNavigation

I am using the last navigation library (version 2.4.0) which include multiple backstacks with a bottom navigation view. The default behavior is that each backstack is saved when user go back to a tab. I want to clear a backstack when the user leave…
10
votes
1 answer

How to manage BottomNavigationView backstack in Android Navigation Component

I am using navigation component and BottomNavigationView, i am facing a problem, that is when i go to from fragment 1>2>5>4>3 and when i press back button i get fragment 1. I know this is the default behavior but i don't want this, i want to save…
10
votes
4 answers

Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView

I'm trying to add BottomNavigationView to my layout with this library: implementation 'com.google.android.material:material:1.0.0' This is my layout:
Saman Sattari
  • 3,322
  • 6
  • 30
  • 46
10
votes
2 answers

BottomNavigationView jumps up leaving blank space when fullscreen

For a BottomNavigationView's last tab, I want the content to be below the status bar and make the status bar completely transparent. This works as expected but the BottomNavigationView jumps up leaving a blank space in the bottom when the last tab…
Drunken Daddy
  • 7,326
  • 14
  • 70
  • 104
10
votes
3 answers

How to create the custom item of Bottomnavigationview Android?

I am using the Bottomnavigationview for tab-bar in my application, for it, i am using the following code.Please check it once. Layout :-
Ravindra Kushwaha
  • 7,846
  • 14
  • 53
  • 103
10
votes
2 answers

How to show BottomNavigation CoordinatorLayout in Android

In my application I want show BottomNavigation bottom of CoordinatorLayout and for this I write below code :
OoO 3
  • 113
  • 1
  • 2
  • 8
10
votes
3 answers

Bottom Navigation View menu item title size

Good Morning, i am using bottom navigation view to do my bottom menu. and now the title is too big and i can't found any solution to solve it
JsLaw
  • 153
  • 1
  • 3
  • 17
10
votes
4 answers

BottomNavigationView disable shift mode without using reflection

BottomNavigationView doesn't allow disabling shift mode has this issue fixed in new version of support library? Also there are some solutions which use reflection mechanism I don't think its right way is there any solution to this major…
10
votes
6 answers

Force showing icon and title in BottomNavigationView support android

After adding 4 items in my menu.xml file for the BottomNavigationView it shows only selected item title and hides all other titles. Can I force showing the title and the icon. here is my code.
Abdelrhman Talat
  • 1,205
  • 2
  • 13
  • 25
10
votes
0 answers

Android BottomNavigationView with custom views as icons

I'm trying out the new BottomNavigationView from the Android Support library. For one of the menu items I would like to have a custom view so that I can add a circular user image programatically as an icon. After using, this does not seem possible…
apSTRK
  • 477
  • 7
  • 21
9
votes
2 answers

How to change the color of active indicator bottombavigationview material You? material3

I want to change the color of the selected area in the bottom navigation view material 3, but the color does not change in any way. I've tried selector, background, background Tint, and styles. All unsuccessfully. Currently like this. It should be…
9
votes
6 answers

Android clear backstack after reselecting Bottom Navigation tab

Using the newest Navigation Component with the BottomNavigationView, the NavController now saves and restores the states of tabs by default: As part of this change, the NavigationUI methods of onNavDestinationSelected(),…
9
votes
5 answers

How can i dynamically change bottom navigation items text?

Im trying to achieve the above design. I'm able to change the icons, but cannot change the bottom text. Im using material bottom navigation bar I achieved the icon change by implementing separate selector drawables for each icon. Is there any way…
9
votes
3 answers

How to change the color of BottomNavigationView badge background?

I have implemented BottomNavigationView with badge count based on this example https://stackoverflow.com/a/56340643/6699103 it works fine but I wanted to change the background color for badge Is there any way to do that?
9
votes
3 answers

BottomNavigationView goes up when keyboard appears using Android WebView

This answer doesn't work for WebViews, this doesn't either. So this question is specifically for when using a WebView. Below code loads a webpage with a text input field. When clicking the text input field, the keyboard comes up. public class…
Jim Clermonts
  • 1,694
  • 8
  • 39
  • 94