Tabbed Layouts
An Overview of Tabbed Layouts in Android
- PDF for offline use
- Related Articles:
- Related Links:
Let us know how you feel about this
Translation Quality
0/250
last updated: 2017-08
Contents
- Overview
- ActionBarSherlock
- Navigation Tabs with the ActionBar
- TabHost Overview
- Creating a Tabbed UI with TabHost
Overview
Tabs are a popular user interface pattern in mobile applications because of their simplicity and usability. They provide a consistent, easy way to navigate between various screens in an application. Android has several API's for tabbed interfaces:
TabHost – This is the original API for creating tabbed user interfaces. A
TabHostwidget is added to a layout and acts as a container for tabbed views. This API has since been deprecated and it's use is discouraged.ActionBar – This is part of a new set of API's that was introduced in Android 3.0 (API level 11) with goal of providing a consistent navigation and view-switching interface. It has been back ported to Android 2.2 (API level 8) with the Android Support Library v7.
PagerTabStrip – Indicates the current, next, and previous pages of a
ViewPager.ViewPageris available only via Android Support Library v4. For more information aboutPagerTabStrip, see ViewPager.Toolbar –
Toolbaris a newer and more flexible action bar component that replacesActionBar.Toolbaris available in Android 5.0 Lollipop or later, and it is also available for older versions of Android via the Android Support Library v7 NuGet package.Toolbaris currently the recommended action bar component to use in Android apps. For more information, see Toolbar.
These API's are visually very different, and are not compatible with
each other. The following screen image shows TabHost and ActionBar
side-by-side:

These incompatible API's exist because of significant UI changes
since Android 3.0 (API level 11). One of these UI changes was the
action bar design pattern,
a pattern intended to provide easy access to navigation and key
functionality in an application. The ActionBar API was introduced to
support this pattern.
The ActionBar API is simpler and arguably provides a better user
experience. It has been back ported to Android 2.2 and is the preferred
choice for Xamarin.Android applications.
The TabHost API is compatible across all versions of Android but
requires more effort to use and is not consistent with the current
Android UI Guidelines.
Developers are discouraged from using this API and should favour the newer
ActionBar for their Xamarin.Android applications.
ActionBarSherlock
Before the ActionBar API's were backported to Android 2.2, developers
who wanted the newer look and feel of the ActionBar API but could use a
third-party library,
ActionBarSherlock. ActionBarSherlock is
an extension of the Android Support Library designed to backport the
action bar design pattern to Android 2.x. When running on Android 3.0
or higher, ActionBarSherlock will automatically use the native
ActionBar API provided by Android. Older versions of Android will use
a custom implemention that will mimic the look and feel of the newer
ActionBar API. The
ActionBarSherlock component
makes it easy to add ActionBarSherlock to a Xamarin.Android
application.
Let us know how you feel about this
Translation Quality
0/250
Xamarin Workbook
If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.

