The AppBar and toolbar of the Android design package

Source: Internet
Author: User

In front of the design package of coordinatorlayout and Snackbar mixing, and now continue to understand the design package appbar;

Appbarlayout, like its name, takes the components of the container class all as AppBar.

Such as:

<android.support.design.widget.appbarlayout        android:layout_width= "match_parent"        app:theme= "@style/ Base.ThemeOverlay.AppCompat.Dark.ActionBar "        android:layout_height=" wrap_content ">        < Android.support.v7.widget.Toolbar            app:layout_scrollflags= "scroll|enteralways"            android:layout_width= " Match_parent "            android:layout_height="? actionbarsize "            android:id=" @+id/main_toolbar "/>        < TextView            android:layout_width= "match_parent"            android:layout_height= "wrap_content"            android:text= " Hover entry "/>    </android.support.design.widget.AppBarLayout>

  

Here is to put toolbar and textview into the appbarlayout, let them as a whole as appbar.

Referencing AppBar's

App:layout_scrollflags= "Scroll|enteralways"
property, you can implement the drop-down when the AppBar is not displayed, while the pull-up shows the AppBar. This is really useful in user interaction.



Take a look at the collapsible toolbar.
 <android.support.design.widget.appbarlayout android:layout_width= "match_parent" app:theme= "@style/base.t        HemeOverlay.AppCompat.Dark.ActionBar "android:layout_height=" Wrap_content "> <!--collapsible toolbar--> <android.support.design.widget.collapsingtoolbarlayout android:layout_width= "Match_parent" and roid:layout_height= "Wrap_content" app:contentscrim= "@color/colorprimary" app:layout_scrollflags= "SCR Oll|exituntilcollapsed "> <imageview android:layout_width=" match_parent "and roid:layout_height= "200DP" app:layout_collapsemode= "parallax" android:src= "@mipmap/ic_launch                Er "/> <android.support.v7.widget.toolbar app:layout_scrollflags=" Scroll|enteralways " Android:layout_width= "Match_parent" android:layout_height= "? Actionbarsize" Android : id= "@+id/main_toolbar"/> </android.support.design.widget.CollapsingToolbarLayout> <!--<TextView--> &lt ;! --android:layout_width= "Match_parent"-<!--android:layout_height= "Wrap_content"-<!- -android:text= "Hover entry"/>--> </android.support.design.widget.AppBarLayout>

It's very simple. You just need to modify it in the code above.

The AppBar and toolbar of the Android design package

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.