An Overview of Tabbed Layouts in Android
- PDF for offline use
- Related Articles:
- Related Links:
Let us know how you feel about this
last updated: 2017-08
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.
Toolbaris a newer and more flexible action bar component that replaces
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
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.
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.
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.
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
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
makes it easy to add ActionBarSherlock to a Xamarin.Android