Appbarlayout
Appbarlayout, like its name, takes the components of the container class all as AppBar. is a ViewGroup container component that inherits the Linerlayout implementation, which is designed for material design app Bar and supports gesture swipe operations.
The default appbarlayout is vertically oriented, and its role is to appbarlayout the contents of the package as AppBar.
is that Put toolbar and tablayout in the appbarlayout, let them as a whole as a appbar.
Common code layouts:
<android.support.design.widget.appbarlayout
Android:id= "@+id/appbar"
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content" >
<android.support.v7.widget.toolbar
Android:id= "@+id/toolbar"
Android:layout_width= "Match_parent"
android:layout_height= "? Attr/actionbarsize"
Android:background= "? Attr/colorprimary"
android:minheight= "Attr/actionbarsize" ></android.support.v7.widget.Toolbar>
<android.support.design.widget.tablayout
Android:id= "@+id/tabs"
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
app:layout_scrollflags= "Scroll"
App:tabindicatorcolor= "@android: Color/holo_red_dark"
App:tabselectedtextcolor= "@android: Color/holo_red_dark"
App:tabtextcolor= "@android: Color/black"/>
</android.support.design.widget.AppBarLayout>
Note: Appbarlayout must be a parent layout container for toolbar
Appbarlayout is supported for gesture swipe, but works with Coordinatorlayout .
Coordinatorlayout
From for notes (Wiz)
Android? M? Control: Appbarlayout