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

How to avoid recreating a new activity every time when bottom navigation view is clicked

I have a BottomNavigationView containing 3 options. Each option on clicking starts an activity using startActivity. Then based on the operations in each activity, i will just attach/replace fragments on it. Now the problem i am facing is, each time…
user305774
  • 123
  • 15
0
votes
3 answers

How to let BottomNavigationView stay down even when opening keyboard?

I have a editText View, a RecyclerView and a Bottom Navigation View. When I tip on the EditText, then the keyboard opens and theRecyclerView is filled. But the BottomNavigationview is still on top of the now open keyboard, while my Recyclerview is…
Tobias D
  • 87
  • 1
  • 2
  • 13
0
votes
1 answer

How to bind FAB to Bottom Navigation Bar from outer layout?

How to bind FAB to Bottom Navigation Bar from outer layout? I want to to bind FAB to Bottom Navigation Bar in such way that when user is scrolling up and Bottom Navigation Bar is hiding (by scrolling down) I want my FAB to scroll down together with…
Ksenia
  • 3,453
  • 7
  • 31
  • 63
0
votes
1 answer

Kotlin: Hide/show BottomNavigationView on scroll

I have implemented a BottomNavigationView and I would like to hide the menu on scroll. In the MainActivity private val mOnNavigationItemSelectedListener = BottomNavigationView.OnNavigationItemSelectedListener { item -> when (item.itemId)…
gon250
  • 3,405
  • 6
  • 44
  • 75
0
votes
1 answer

Always show icon with label in BottomNavigationView for more then 3 items

I am using 5 items in BottomNavigationView but it only shows the label text for the active one. It works fine for the 3 item but not for more than 3 items. Current view All i want is like…
Nouman
  • 122
  • 2
  • 11
0
votes
2 answers

bottom navigation bar in android application

I develop an android application and I need to prevent the user to close the application from navigation bar buttons .. there is another way to close the application. I search a lot and didn't find any way to Permanently hide bottom navigation bar…
0
votes
3 answers

Snackbar not showing up

So, I have a Homepage activity which contains BottomNavigationView and FrameLayout. On clicking tabs of BottomNavigationView, I am inflating different fragments. My codes are as follows: activity_homepage.xml
0
votes
1 answer

Get Snackbar above Navigation Bar

I have activity_home_page.xml which has a FrameLayout and bottomNavigationView. activity_home_page.xml
0
votes
1 answer

Android bottom navigation bar visibility

How can I make the bottom Navigation bar appear on selected activities and don't appear on others ? What lines should I add to make it happen
0
votes
1 answer

using different Background Color of Bottom NavigationBar Tab

I'm adding a BottomNavigationView to a project, and I would like to have a different background color for each bottom tab.Using a different color with android:state_selected="true" in a color selector resource file doesn't seem to work.I also tried…
Rahul Bh
  • 123
  • 2
  • 15
0
votes
2 answers

flutter bottomsheet with notch (similar to bottomNavigationBar: BottomAppBar's shape property)

question 1: how to add a notch to flutter bottom sheet around the floatingactionbutton, so that it looks like a bottomappbar (with shape of CircularNotchedRectangle()) but behave like bottomsheet (can drag to dismiss) question 2: how to make a…
Derek Zhu
  • 173
  • 2
  • 11
0
votes
1 answer

set OnClickListener in specific item (seperate for all item)?

I want to add clickListener to all specific item item1, item2, item3 and I want to set separate fragment on this. can anyone please help me to set onClickListener in every item. This is my code: public class BottomNavigation extends…
Shrawan Thakur
  • 829
  • 7
  • 8
0
votes
1 answer

How to avoid Fragment reload data when pressing back from bottom navigation

Can anyone help me to solve the problem when fragment reload data every single tab back. This is my MainActivity class MainActivity : AppCompatActivity() { private fun addBottomView(){ …
0
votes
0 answers

Navigation Drawer with Bottom navigation drawer

How to use both Navigation Drawer and Bottom Navigation View in same screen . i would like to open from the bottom navigation same as it opens when toggle(menu icon ) is clicked in Navigation app bar. Not able to open Navigation drawer from bottom…
0
votes
1 answer

Initialization of a fragment causes the animation lag

While writing an Android app, I encountered a problem with a stuttering animation. I use AHBottomNavigation for navigation, FragNav is for swapping fragments and FlexibleAdapter for RecyclerView. The application is built from one activity and five…