What is the difference between Action Bar and newly introduced Toolbar?

三世轮回 提交于 2019-12-29 02:18:27

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/27665018/what-is-the-difference-between-action-bar-and-newly-introduced-toolbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!