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 difference is and when I would use one over the other.

- 1,233
- 2
- 9
- 12
3 Answers
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.

- 8,555
- 7
- 47
- 54
-
1This is the right answer as well. Thank you so much. – Aleckson Nyamwaya May 22 '19 at 16:57
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

- 20,103
- 7
- 48
- 67
-
"http://android-developers.blogspot.com/2015/05/android-design-support-library.html" is AppBarLayout mentioned in that link somewhere - I can't see it. – Marian Paździoch Apr 05 '16 at 08:41
-
1I know I am 4 years late but I've marked this as the accepted answer because you answered the day I asked. and its the right answer of-crouse – Aleckson Nyamwaya May 22 '19 at 17:00
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.

- 89
- 1
- 3