What is the difference between AppBarLayout vs Toolbar?

前端 未结 3 512
说谎
说谎 2021-01-29 23:24

I want to include Toolbar in my app, but the design support library just came out with AppBarLayout, so I just need clarification on what the differenc

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-30 00:07

    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.

提交回复
热议问题