Can i add more than 5 menu items in bottom navigation view?
Asked Answered
K

4

8

I am trying to add more then 5 items in bottom navigation view but its causing inflate error.

Koah answered 5/8, 2019 at 8:35 Comment(3)
kindly share your code you have done yet so farGraph
for more than 5 items, BottomNavigation is not a good choice rather you should choose Tabs with pagerLandscape
For other people looking for this, it's possible, check my post below: https://mcmap.net/q/1266197/-can-i-add-more-than-5-menu-items-in-bottom-navigation-viewIsotherm
N
10

According to Google's Material Design specification, BottomNavigationView does not support more than 5 items. You can use another library for BottomNavigationView since you can't achieve this with Google's library.

Create a menu resource with up to 5 navigation targets (BottomNavigationView does not support more than 5 items).
https://material.io/develop/android/components/bottom-navigation-view/

Secondly, Having 5 or more items in BottomNavigation is a bad design in terms of User Experience. Even 4 is a stretch. If you need more than 5 items, BottomNavigation is not suitable for you.

Nogood answered 5/8, 2019 at 8:40 Comment(1)
Having 5 or more items in BottomNavigation is a bad design in terms of User Experience. Even 4 is a stretch. — This answer seems awfully dogmatic without providing heuristics, evidence, or proof. What is bad about, e.g., this AirBnB screen?Bulbiferous
M
3

According to Material Design Specification, it is a bad practice to use more than 5 menu items for BottomNavigationView. Since, it is used to show only 3 to 5 top-level destinations(not related to same subject but of equal importance), I suggest you to use Navigation Drawer instead. Also, I would only recommend you to use Tab Layout with ViewPager, if the destinations are connected to a common subject.

To illustrate it further, let's assume there is a Pill Reminder app. The related destinations can be Pending, Completed and/or Missed which are related in a way that they all show status of all Reminder at a point of time. To show these information, I would use ViewPager with TabLayout.
For other destinations such as Settings, Nearby Pharmacies, etc. which are top-level, I would use NavigationDrawer.

Micrography answered 4/7, 2020 at 14:27 Comment(1)
Sorry for the late response @cbg_pandey. But the issue is that when you want to build dynamic layouts there is enough space on a tablet to show more. So I do not fully agree with the assessment on Google's end. They should let developers decide.Millpond
H
2

If you want that then u can take a Horizontal linear layout in that take the horizontal scroll and then take textview or button as much u like.

Havard answered 4/7, 2020 at 12:48 Comment(0)
I
2

Currently (2023), you can have more than 5 items in bottom navigation view as explained here (emphasis mine):

We have design concerns around allowing more items than 5. If you really need that, you can extend BottomNavigationView and override getMaxItemCount() to provide a different value than 5.

source: https://github.com/material-components/material-components-android/issues/543#issuecomment-881579335

BUT take into account that it will only work from version 1.8.0 and up

source: https://github.com/material-components/material-components-android/pull/2923

Isotherm answered 27/9, 2023 at 23:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.