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
197
votes
11 answers

BottomNavigationView display both icons and text labels at all times

I am using android.support.design.widget.BottomNavigationView from design support library version 25 compile 'com.android.support:design:25.0.0'
166
votes
24 answers

Set selected item in Android BottomNavigationView

I am using the new android.support.design.widget.BottomNavigationView from the support library. How can I set the current selection from code? I realized, that the selection is changed back to the first item, after rotating the screen. Of course it…
Michael
  • 2,021
  • 3
  • 12
  • 18
151
votes
21 answers

How to disable BottomNavigationView shift mode?

BottomNavigationView doesn't show menu's title that are inactive. How to show titles of all menu elements in bottomNavigationBar? The problem is that in my case shown only title of element that is clicked.
Natan Rubinstein
  • 1,873
  • 3
  • 11
  • 13
146
votes
14 answers

Android new Bottom Navigation bar or BottomNavigationView

Saw the new guideline came out, and used in google photos latest app. Have no idea how to use the new Bottom Navigation Bar. See through the new support lib, didn't find any lead. Can not find any official sample. How to use the new Bottom bar?…
zjywill
  • 1,458
  • 2
  • 10
  • 14
141
votes
11 answers

Is there a way to keep fragment alive when using BottomNavigationView with new NavController?

I'm trying to use the new navigation component. I use a BottomNavigationView with the navController : NavigationUI.setupWithNavController(bottomNavigation, navController) But when I'm switching fragments, they are each time destroy/create even if…
IdAndro
  • 1,433
  • 2
  • 8
  • 7
110
votes
17 answers

Display badge on top of bottom navigation bar's icon

I have implemented the bottom navigation view in my app and I have looked every where to display badges on top of the icons like this I was wondering whether this is even possible to implement. Any help is appreciated. Thank you.
heisenberg91
  • 1,566
  • 2
  • 12
  • 16
105
votes
8 answers

Remove BottomNavigationView labels

Google released new support library v25 with BottomNavigationView is there any way to remove items labels ?
104
votes
11 answers

Android: Bottom Navigation View - change icon of selected item

I have added BottomNavigationView in my application like. main.xml
86
votes
7 answers

item selected color in android BottomNavigationView

I refer this. Schedules Activity is appeared when I click Schedules, but first item color (Favorites) is always selected. It doesn't change Schedules item color from Favorites item color. And also, third item (Music). I use android:state_checked…
WPG
  • 945
  • 1
  • 7
  • 10
81
votes
14 answers

Android Jetpack Navigation, BottomNavigationView with Youtube or Instagram like proper back navigation (fragment back stack)?

Android Jetpack Navigation, BottomNavigationView with auto fragment back stack on back button click? What I wanted, after choosing multiple tabs one after another by user and user click on back button app must redirect to the last page he/she…
67
votes
16 answers

Fragment re-created on bottom navigation view item selected

Following is my code for bottom navigation view item selected bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull…
61
votes
11 answers

Hide/Show bottomNavigationView on Scroll

I have to hide bottom navigation view on up scroll and show on down scroll .how to implement this? my layout is like this
54
votes
6 answers

How to hide the BottomNavigationView below keyboard with adjustResize set

According to the material design spec, when the keyboard appears, the BottomNavigationView should hide underneath it. However, if I set android:windowSoftInputMode="adjustResize" in the Activity's manifest then the BottomNavigationView moves above…
willjgriff
  • 783
  • 2
  • 6
  • 11
49
votes
12 answers

Set initially selected item index/id in BottomNavigationView

I have implemented BottomNavigationView and have no idea how to set selection index or MenuItem id (in my case, middle item should be selected by default). I'm afraid there's no such possibility for now as far as it's too raw yet, but anyways any…
47
votes
7 answers

How to use BottomNavigationBar with Navigator?

The Flutter Gallery example of BottomNavigationBar uses a Stack of FadeTransitions in the body of the Scaffold. I feel it would be cleaner (and easier to animate) if we could switch pages by using a Navigator. Are there any examples of this?
Paul
  • 1,943
  • 5
  • 18
  • 18
1
2 3
99 100