The Wayback Machine - https://web.archive.org/web/20240630013438/https://www.geeksforgeeks.org/difference-between-appbar-actionbar-and-toolbar-in-android/
Open In App

Difference Between AppBar, ActionBar, and Toolbar in Android

Last Updated : 23 Feb, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

AppBar

AppBar is a design element in an application’s activity that has a significant role. Its appearance gives a unique identity to the application. Moreover, it displays the title of the current activity that facilitates users to know their location in the application. To give a consistent look to an application, developers use AppBar. Prior to Android 3.0(Honeycomb), the user interactive elements like any option or action are placed inside the Menu button located in the AppBar. Components included in the AppBar are:

  • Title
  • Menu button

AppBar in an application:

ActionBar

ActionBar is the element present at the top of the activity screen. It is a salient feature of an android application that has a consistent presence over all its activities. It provides a visual structure to the app and contains some of the frequently used elements for the users. Android ActionBar was launched by Google in 2013 with the release of Android 3.0(API 11). Before that, the name of this top most visual element was AppBar. All applications that use the default theme provided by the Android(Theme.AppCompat.Light.DarkActionBar), contains an ActionBar by default. However, developers can customize it in several ways depending upon their needs. Components that can be included in the ActionBar are:

  • Navigation control button/drawer
  • App icon
  • Title and Subtitle
  • Action button
  • Action overflow menu

ActionBar in an application:

Toolbar

The Toolbar is a kind of ViewGroup that can be placed in the XML layouts of an activity. It was introduced by the Google Android team during the release of Android Lollipop(API 21). The Toolbar is basically the advanced successor of the ActionBar. It is much more flexible and customizable in terms of appearance and functionality. Unlike ActionBar, its position is not hardcoded i.e., not at the top of an activity. Developers can place it anywhere in the activity according to the need just like any other View in android. Toolbar use material design theme features of Android and thus it provides backward compatibility up to API 7(Android 2.1). Features supported by the Toolbar are much more focused and customizable than the ActionBar. Following are the components that can be added to a Toolbar:

  • A navigation button/drawer or an Up button
  • Brand logo/App icon
  • Title and Subtitle
  • ActionMenu items
  • Multiple custom views such as TextView, ImageView, etc.

Both ActionBar(at the top) and Toolbar in an application:

Difference Table

AppBar

ActionBar

Toolbar

It is a dedicated space located at top of an activity that indicates the app title or location of a user in the app. It is a dedicated navigation or control element present at top of each screen of the application. It is a ViewGroup that can be placed anywhere in the activity layout.
It was used in Android devices running on OS version older than 3.0(Honeycomb).  It was released along with Android 3.0 (API -11) as the successor of AppBar.   Introduced in material design with the release of Android 5.0 i.e., lollipop(API – 21).
Its position is fixed i.e., at the top of an application screen. It is a part of the activity’s opaque window decor, thus its position is hardcoded. It is the generalized form of ActionBar that can be placed at any arbitrary level within the Component Tree hierarchy of an activity.  
Android system allows the presence of only one AppBar in an activity. There can be only one ActionBar in an activity. Developers have the choice to show or hide the ActionBar. Multiple Toolbar elements having a completely different appearance and the behavior can be defined within a single activity. A Toolbar can also be used as an ActionBar.
Its prime purpose is to provide identity to the application. Further, it includes a Menu button that is used by developers to display relevant options/actions to the user. Behaves as a regular AppBar but provides scope for customization. Developers can add application logo/icon, action menu items, overflow menu, etc. Fewer lines of code are needed to make the same customization in Toolbar that is possible in ActionBar. Moreover, Toolbar provides more flexibility and control to the developers by which they can animate the elements or can apply reaction to scroll events.
With the increase in demand for devices powered with the latest Android versions, developers migrated their design from the Menu button to ActionBar. Features were added gradually, at the different API levels(15, 17, and 19). Thus it does not provide backward compatibility.  Uses material theme design and provides backward compatibility up to API 7(Android 2.1).


Similar Reads

Difference Between ActionBar and Toolbar in Android
ActionBar ActionBar is the element present at the top of the activity screen. It is a salient feature of an android application that has a consistent presence over all its activities. It provides a visual structure to the app and contains some of the frequently used elements for the users. Android ActionBar was launched by Google in 2013 with the r
3 min read
How to Set Gradient and Image Backgrounds for ActionBar in Android?
UI plays quite significantly to keep the user engaged within the application. The very basic starts with developing a theme for an application. Themes may apply to all the UI elements within the application, but, the first thing that the user may notice is the Action Bar. Action Bar has a theme by default. We can only change its colors from availab
3 min read
How to Add a Custom View Inside ActionBar in Android?
In Android, an Action Bar, or an app bar is a dedicated space at the top of the application on the screen that indicates the name of the application or activity. An Action bar helps users navigate or locate themself in the application. A sample Action Bar is shown in the below image. In this article, we will show you how you could customize the Act
3 min read
Different Ways to Hide ActionBar in Android with Examples
ActionBar is a primary toolbar within the activity that may display the activity title, application-level navigation affordances, and other interactive items. Although Action Bar is an important feature for android applications, sometimes we have the need to hide it in either the entire app, some particular activity, or during some particular work.
4 min read
ActionBar in Android with Example
In Android applications, ActionBar is the element present at the top of the activity screen. It is a salient feature of a mobile application that has a consistent presence over all its activities. It provides a visual structure to the app and contains some of the frequently used elements for the users. Android ActionBar was launched by Google in 20
8 min read
How to Add Switch in Android ActionBar?
In Android, Switch is a two-state toggle switch widget that is used to select a choice between two options. It is generally an on/off button that indicates the current state of the switch. Normal Basic Features for which switch can be used in ActionBar of application: To switch to the dark mode or light mode in the application.To activate or inacti
3 min read
How to Change ActionBar Title Programmatically in Android?
Whenever we develop an Android application and run it, we often observe that the application comes with an ActionBar with the name of the application in it. This happens by default unless explicitly changed. This text is called the title in the application. One can change the title of the application by making changes to the app_name string present
3 min read
How to Use Material Contextual ActionBar Library in Android App?
Let us first understand the two types of app bars in an android app: The Regular AppBarThe Contextual AppBar The Regular AppBar is just a normalized app bar that appears on the top of a page and can be well customized according to the user's requirements. It can be used to display page topics/company names/etc., clickable icons, navigation to other
7 min read
How to Get ActionBar Height in Pixels in Android?
ActionBar is a UI element that is generally empty but can consist menu and runs on top of the activity. The significance of ActionBar is that it displays the application name and can provide a menu to navigate to the user. The rest of the activity which is programmable is completely separate from the ActionBar. Hence, it is important to know the Ac
2 min read
Create Options Menu in ActionBar in Android using Jetpack Compose
In Android, ac ActionBar or a TopBar is a UI element that is present at the top of the activity screen. An ActionBar by default displays the activity name inside it. However, we can add other elements like the back button, images, options menu, etc inside an ActionBar. So in this article, we will show you how you could Create Options Menu in Action
3 min read