Reputation: 5525
Google introduced the Tool Bar widget in AppCompat v21. I understand that you can assign the Tool Bar as the Action Bar (via setSupportActionBar()) in your Activity.
What is the advantage of installing your Tool Bar as the action bar instead of using standalone Tool Bars in your layout all the time? Are there things a Tool Bar can do when its installed as the action bar that it can't do when is used standalone?
The linked article touches on this topic a bit: "Use a Toolbar as an Action Bar when you want to use the existing Action Bar facilities (such as menu inflation and selection, ActionBarDrawerToggle, and so on) but want to have more control over its appearance."
... but they used the catchall "and so on". What other capabilities does an Action Bar provide that one misses out on with a standalone tool bar?
Upvotes: 4
Views: 284
Reputation: 2955
The main advantage of using a toolbar as a part of the UI component is that u can add animations to it.... for instance i think u might have used play store before in that when you open up an app u could see a video of the app or a screenshot of the app display upon scrolling u could see the ActionBar appearing from nowhere....these kind of animations are not possible if you are using an ActionBar in your application... Another instance of using a toolbar is u can hide it when ever u need to... upon scrolling a list view you can hide that so u could provide more room for your content... this cant be done with an ActionBar...
I think that summarizes the essence of ToolBar over ActionBar
EDIT 1 :
Sorry Google changed its play store UI so u will not find that so i would suggest u to look into an app called Zomato
Upvotes: 1