在Google推出Material Design之后,我听说了一个名为Toolbar的新窗口小部件类.
工具栏是什么?ActionBar和Toolbar的确切区别是什么?
在Google推出Material Design之后,我听说了一个名为Toolbar的新窗口小部件类.
工具栏是什么?ActionBar和Toolbar的确切区别是什么?
我从Android Developers Blog post中找到了一个很好的解释.
在这个版本中,Android引入了一个新的工具栏小部件.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,设置动画,并对滚动事件做出react .您还可以将其设置为活动的操作栏,这意味着您的标准选项菜单操作将显示在其中.
是的,我们Android开发人员需要更多地控制ActionBar
以上,对吗?Toolbar
就是为了这个目的.
换句话说,ActionBar
现在变成了一种特殊的Toolbar
.这是Google's official Material Design spec document篇文章的节选.
应用程序栏,以前在Android中称为操作栏,是一种特殊的工具栏,用于品牌、导航、搜索和操作.
上面的博文中包含了更多细节,比如如何使用Toolbar
作为ActionBar
.