What is the difference between AppBarLayout vs Toolbar?

Deadly 提交于 2019-12-02 14:07:43

The AppBarLayout is used to achieve various scrolling behaviors such as collapse, flex space, and quick return.

http://www.google.com/design/spec/patterns/scrolling-techniques.html

http://android-developers.blogspot.com/2015/05/android-design-support-library.html

If you want just to include the Toolbar without any scrolling effects you can use Toolbar. But if you want to make some scrolling effects like on the images you need to use AppBarLayout.

More here and here.

AppBarLayout is a parent layout of ToolBar and ToolBar is custom ActionBar. if you want scroll action on the ToolBar so you should write ToolBar into the AppBarLayout,before you will write code for scroll the ToolBar, you must know the NestedScrollBar,it is used to scroll the ToolBar. but you cannot connect NestedScrollBar and ToolBar directly,because ToolBar is child of AppBarLayout and NestedScrollBar is sibling of AppBarLayout, that's why your Toolbar should in the AppBarlayout then you can connect AppBarlayout and NestedScrollBarLayout for scrolling action on the toolbar.

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