Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between AppBarLayout vs Toolbar?

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.

like image 593
Aleckson Nyamwaya Avatar asked Jul 09 '15 21:07

Aleckson Nyamwaya


People also ask

What is the difference between AppBarLayout and toolbar?

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.

What is AppBarLayout?

AppBarLayout is a vertical LinearLayout which implements many of the features of material designs app bar concept, namely scrolling gestures. Children should provide their desired scrolling behavior through AppBarLayout.

What is difference between toolbar and ActionBar?

The Toolbar is basically the advanced successor of the ActionBar. It is much more flexible and customizable in terms of appearance and functionality. Unlike ActionBar, its position is not hardcoded i.e., not at the top of an activity.

What is the difference between appbar and toolbar in android?

The key differences that distinguish the Toolbar from the ActionBar include: Toolbar is a View included in a layout like any other View. As a regular View , the toolbar is easier to position, animate and control. Multiple distinct Toolbar elements can be defined within a single activity.


2 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.enter image description here enter image description here

More here and here.

like image 162
Sergey Pekar Avatar answered Sep 18 '22 11:09

Sergey Pekar


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

like image 33
tachyonflux Avatar answered Sep 22 '22 11:09

tachyonflux