211

After Google introduced Material Design, I have heard about a new widget class called Toolbar.

What is the Toolbar, and what is the exact difference between ActionBar and ToolBar?

Rob Latham
  • 5,085
  • 3
  • 27
  • 44
김준호
  • 15,997
  • 9
  • 44
  • 38

1 Answers1

207

I found a good explanation from Android Developers Blog post.

In this release, Android introduces a new Toolbar widget. This is a generalization of the Action Bar pattern that gives you much more control and flexibility. Toolbar is a view in your hierarchy just like any other, making it easier to interleave with the rest of your views, animate it, and react to scroll events. You can also set it as your Activity’s action bar, meaning that your standard options menu actions will be display within it.

Yes, we, Android developers, needed more control over ActionBar, right? And Toolbar is just for it.

In other words, the ActionBar now became a special kind of Toolbar. This is an excerpt from Google's official Material Design spec document.

The app bar, formerly known as the action bar in Android, is a special kind of toolbar that’s used for branding, navigation, search, and actions.

More details like how to use Toolbar as an ActionBar are included in above blog post.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
김준호
  • 15,997
  • 9
  • 44
  • 38
  • 50
    Technically, when should one implement `Toolbar` and not `ActionBar` and vice-versa? – Malwinder Singh Jun 17 '15 at 09:56
  • 4
    It provides greater control to customize its appearance unlike old ActionBar. It fully supported Toolbar features to lower android os devices via AppCompact support library. Use a Toolbar as an replacement to ActionBar. In this you can still continued to use the ActionBar features such as menus, selections, etc. Use a standalone Toolbar, where ever you want to place in your application. – Amandeep Rohila Sep 08 '15 at 12:15
  • 2
    @Malwinder go with Toolbar if you really need to change height, style, colors, or more customization of the actionbar. Else for the simple action go with the Actionbar. – Asif Mushtaq May 13 '17 at 21:10