CHAPTER 12
Beginner
Bottom Navigation and Tab Layouts
Updated: May 31, 2026
5 min read
# CHAPTER 12
Bottom Navigation and Tab Layouts
1. Introduction
As smartphones have grown taller, reaching the top of the screen to open a menu has become a physical chore. Modern mobile UX solves this by moving primary navigation to the bottom of the screen, right under the user's thumb. In this chapter, we will design intuitive, accessible navigation using BottomNavigationView for top-level destinations, and TabLayout for organizing sub-categories.2. Learning Objectives
By the end of this chapter, you will be able to:- Understand when to use Bottom Navigation vs. Navigation Drawers.
-
Implement a
BottomNavigationViewusing XML menus.
- Style bottom navigation bars to match your brand.
-
Implement a
TabLayoutfor swiping between categories.
-
Combine
TabLayoutwith aViewPager(or ViewPager2) for seamless swiping.
3. BottomNavigationView Basics
A Bottom Navigation bar should display 3 to 5 top-level destinations. If you have fewer than 3, use Tabs. If you have more than 5, use a Navigation Drawer.Step 1: Create the Menu XML
Create a menu file (e.g., bottomnavmenu.xml) in the res/menu folder:
xml
Step 2: Add to Layout
Place the BottomNavigationView at the bottom of your main layout (using a ConstraintLayout or RelativeLayout).
xml
4. Customizing Bottom Navigation
You can style the navigation bar to look modern and flat.-
app:itemIconTint: Set a color state list to change the color of the active vs. inactive icons.
-
app:itemTextColor: Change the text color based on state.
-
app:labelVisibilityMode: Choose whether the text labels always show, never show, or only show on the selected item (selectedmode is a very popular modern design pattern).
5. TabLayout for Sub-Navigation
While Bottom Navigation is for moving between completely different sections of an app, Tabs are used to organize related data on the *same* screen (e.g., "Chats", "Status", and "Calls" in a messaging app).
xml
-
app:tabMode="fixed": All tabs fit on the screen equally.
-
app:tabMode="scrollable": Useful if you have many tabs; the user can swipe horizontally to see more tabs.
6. Combining TabLayout with ViewPager2
ATabLayout usually doesn't exist alone. Users expect to be able to swipe the screen left or right to switch tabs. This is achieved using a ViewPager2.
You place the ViewPager2 below the TabLayout in your XML, and then link them together in your Kotlin code using TabLayoutMediator.
7. Mini Project: Multi-Screen Navigation
Let's build the XML for a screen that has an AppBar, a TabLayout below it, a ViewPager taking up the middle, and a BottomNavigationView at the bottom.
xml
8. Design Principles
- Thumb Zone: Critical actions should be placed in the bottom third of the screen, making them accessible to a user holding a phone with one hand.
- Visual Feedback: The selected tab or bottom nav item must be visually distinct (using color or filled icons) from the unselected items so the user always knows "where they are."
9. Common Mistakes
- Putting too many items in Bottom Nav: Adding 6 or 7 items shrinks the touch targets, causing accidental clicks. Use 3 to 5 max.
- Hiding Bottom Nav unnecessarily: While you can hide the bottom nav when scrolling down a list to save screen space, ensure it reappears immediately upon scrolling up.
10. Best Practices
- Use outlined/hollow icons for unselected states and filled/solid icons for the selected state to create a strong visual cue.
-
Use
BadgeDrawableto show notification dots (like unread message counts) on your Bottom Nav items.
11. Exercises
-
1.
Modify a
BottomNavigationViewso that the text labels only appear on the currently active item.
-
2.
Create a
TabLayoutwithapp:tabMode="scrollable"and add 8 dummy tabs to see how the horizontal scrolling behaves.
12. UI Design Challenges
Challenge: Design a "Floating Bottom Navigation". Instead of the navigation bar touching the very bottom and stretching edge-to-edge, use aMaterialCardView to create a pill-shaped navigation bar that "floats" 16dp above the bottom of the screen.
13. MCQ Quiz with Answers
Question 1
According to Material Design guidelines, what is the maximum recommended number of destinations in a Bottom Navigation bar?
Question 2
Which Android component is commonly paired with TabLayout to allow users to swipe left and right between tab contents?
14. Interview Questions
- Q: What UX problems does Bottom Navigation solve compared to a Navigation Drawer?
- Q: Explain the difference between primary navigation (Bottom Nav) and secondary navigation (Tabs).
- Q: How would you display a badge with an unread count of "3" on a BottomNavigationView item?
15. Summary
In this chapter, we shifted our navigation paradigm to the bottom of the screen, embracing modern, ergonomic UI design. We learned how to configure and style aBottomNavigationView for major app sections, and how to utilize TabLayout paired with a ViewPager2 to effortlessly organize swipable sub-categories.