Action bar navigation modes are deprecated in Android L
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
With the release of Android L (Lollipop), Google deprecated Action Bar navigation modes as part of the broader shift toward Material Design. Developers who relied on tab and drop-down navigation modes in the Action Bar needed to migrate to modern alternatives like Toolbar, TabLayout, and the Navigation Component. This article covers why the deprecation happened, what replaced these modes, and how to migrate existing code.
Why Action Bar Navigation Modes Were Deprecated
Action Bar was introduced in Android 3.0 (Honeycomb) and provided built-in navigation modes including tabs (NAVIGATION_MODE_TABS) and drop-down lists (NAVIGATION_MODE_LIST). While convenient, these modes had several limitations that conflicted with the goals of Material Design.
The tab and list modes were tightly coupled to the Action Bar itself, making it difficult to customize their appearance or position them independently. On smaller screens, tabs would collapse into a stacked bar, consuming valuable vertical space. The rigid API also prevented developers from implementing fluid transitions and animations that Material Design requires.
Google's solution was to deprecate these navigation modes entirely and provide standalone components that offer greater flexibility. The Toolbar widget replaced the Action Bar as the primary app bar, while TabLayout from the Design Support Library became the recommended way to implement tabbed navigation.
Migrating from Action Bar Tabs to Toolbar and TabLayout
The most common migration path involves replacing Action Bar tabs with a combination of Toolbar, TabLayout, and ViewPager2. Here is a complete example.
First, update your theme to use NoActionBar so the system does not create a default Action Bar:
Next, define your layout with a Toolbar and TabLayout above a ViewPager2:
Then wire everything together in your Activity:
Migrating Drop-Down Navigation to a Spinner in Toolbar
For apps that used NAVIGATION_MODE_LIST, the replacement is a Spinner placed directly inside the Toolbar:
Using the Jetpack Navigation Component
For new projects, the Jetpack Navigation Component is the recommended approach. It provides a declarative way to define navigation graphs and handles fragment transactions, back stack management, and deep linking automatically.
The Navigation Component pairs well with BottomNavigationView for bottom tab navigation, which has largely replaced top-level Action Bar tabs in modern Android apps.
Common Pitfalls
Forgetting to switch the app theme to NoActionBar is a frequent mistake. If you use both a Toolbar and a default Action Bar, the app will crash with an IllegalStateException because it tries to set two action bars.
Another common issue is not using TabLayoutMediator to connect TabLayout with ViewPager2. Without the mediator, tabs will not update when the user swipes between pages, and tapping a tab will not scroll the pager.
When migrating legacy code, watch for direct references to getActionBar().setNavigationMode(). These calls will still compile against newer SDK versions but will have no effect, leading to confusing behavior where the navigation simply disappears.
Summary
Action Bar navigation modes were deprecated in Android L because they were inflexible and inconsistent with Material Design principles. The modern replacements, Toolbar with TabLayout and ViewPager2, provide full control over appearance and behavior. For new projects, the Jetpack Navigation Component offers the most maintainable approach. When migrating, switch your theme to NoActionBar, replace tab logic with TabLayoutMediator, and remove all calls to the deprecated setNavigationMode API.

