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
7
votes
1 answer

How to add rounded corners to BottomAppBar with CircularNotchedRectangle in Flutter

I want to create BottomAppBar with rounded corners, circular notched rectangle and material shadow. The problem is that when I add rounded corners to BottomAppBar by wrapping it with ClipRRect widget I lose material shadow. BottomAppBar without…
7
votes
3 answers

How to remove icons from the BottomNavigationBar?

I just need the the label in my BottomNavigationBarItem's but I cant find a way to remove them. You can hide the labels with showSelectedLabels and showUnselectedLabels set to false but there are no equivalent for…
Joel Broström
  • 3,530
  • 1
  • 34
  • 61
7
votes
0 answers

Animation issues when using BottomNavigationView with NavController and each Fragment has its own Toolbar

I'm developing an app in Kotlin using some of the latest Android Jetepack components. I've recently had a bit of a hitch with the following case: This issue seems to occur when using BottomNavigationView with NavController, and when each Fragment…
7
votes
3 answers

How to add Floating action Button in Bottom Navigation Bar in Center with border?

I am trying to add a Floating Action Button in the middle of the Bottom Navigation bar. Problem is border is not appearing and also margin in Floating Action Button and icons not according to my requirement. Here is a picture of the issue. Achieved…
7
votes
5 answers

How to programmatically change Bottom Navigation View's Icons?

I want know how can I change Bottom Navigation View's Icons when user basically selects it and then again replace it with previous icon if user selects different option. Below is my switch case snippet. switch (menuItem.getItemId()) { …
Kaushal
  • 217
  • 1
  • 4
  • 12
7
votes
4 answers

How to set indicator in BottomNavigationView?

I want to set indicator on bottomNavigationView.You can see that orange line at bottom side How to set indicator? I didn't find any example for indicator.
Khashchuluun
  • 169
  • 1
  • 13
7
votes
0 answers

How to know when Samsung S8, S8+, S9, ect bottom navigation bar is visible?

The bottom navigation bar on Samsung S8, S8+, S9, ect causes a UI and animation nightmare for views moving in and out from top and bottom of my app when toggled off. For these devices if the navigation bar is toggle on everything works perfectly,…
portfoliobuilder
  • 7,556
  • 14
  • 76
  • 136
7
votes
0 answers

Implementing Material Design onboarding example

I'm looking at Material's onboarding design guideline. I was wondering how I should approach replicating this kind of navigation. It seems to incorporate a special bottom tabbar and viewpager. Without the swipe-through feature of viewpager, and with…
7
votes
5 answers

Bottom Sheet Above Bottom Navigation

My goal is to place a "bottom sheet" on top of a BottomNavigationView like this: But it stays the following way. Both views collapse: This is the xml of my main activity:
7
votes
5 answers

BottomNavigationView back button behavior should work like the Youtube App but crashes

Steps to reproduce: Start a new Android project, choose "BottomNavigationView": Replace MainActivity with this: class MainActivity : AppCompatActivity() { private var fragmentIds = ArrayList() val fragmentA: FragmentA = FragmentA() private…
Jim Clermonts
  • 1,694
  • 8
  • 39
  • 94
7
votes
3 answers

Bottom Navigation View With Left Righ Space Issue

I am newbie in android, i am use bottom navigation view with two menus but im getting left right space Here is my Navigation View,
Dhara
  • 118
  • 1
  • 5
7
votes
3 answers

Set default menuItem for BottomNavigationView

How can i set the default MenuItem for the official BottomNavigationView (com.android.support:design:25.0.1)? If I call programmatically menuItem.setCheckable(true).setChecked(true) the zoom effect is not performed and the BottomNavigationView shows…
Bronx
  • 4,480
  • 4
  • 34
  • 44
6
votes
0 answers

Android jetpack navigation does not work after adding multiple back stack support [2.4.+]

I updated the navigation library from 2.3.5 to 2.4.2. After update I started getting this error: java.lang.IllegalArgumentException: No destination with ID XXX is on the NavController's back stack. The current destination is null. The error occurs…
6
votes
2 answers

Switch tab on button click with Bottom Navigation and Navigation component

I have a very simple app that consists of three Fragments and a Bottom Navigation bar, created by using "New Project -> Bottom Navigation Activity" in Android Studio. The first Fragment holds a button, which should take me to the second Fragment,…
6
votes
2 answers

BottomNavigationView navigation items text displayed above icon

After upgrading dependency: 'com.google.android.material:material:x.x.x' from 1.4.0 to 1.5.0, the navigation items text has somehow changed from being anchored below the icon to on top of it: From: To: Is this a feature or a bug and does this…
tendai
  • 1,172
  • 1
  • 11
  • 22