Android advanced light-Material Design,

Source: Internet
Author: User

Android advanced light-Material Design,

Next to the Android advanced light-New Features of Android

No1:

Components:

1) Bottom work bar-Bottom Sheets

2) card-Cards

3) Prompt box-Dialogs

4) menu-Menus

5) Selector

6) slider control-scyclers

7) Progress and Dynamics

8) Snackbar (the pop-up box can be operated at the bottom) and Toast

9) Tab

No2:

Snackbar

Contains text information and an optional operation button

Snackbar. make (activity_main, "title", Snackbar. LENGTH_LONG ). setAction ("Click Event", new View. onClickListener () {@ Override public void onClick (View v) {Toast. makeText (MainActivity. this, "Toast", Toast. LENGTH_LONG ). show ();}}). setDuration (Snackbar. LENGTH_LONG ). show ();

The first parameter of make is a View parameter, which is the parent control of Snackbar.

No3:

TextInputLayoutInput box container (hint floating, shown below error prompt)

<android.support.design.widget.TextInputLayout    android:id="@+id/t1_username"    android:layout_width="match_parent"    android:layout_height="warp_content"    android:layout_centerInParent="true">    <EditText        android:id="@+id/et_username"        android:layout_width="match_parent"        android:layout_height="warp_content"        android:hint="username"        android:maxLength="25"        android:maxLines="1"/></android.support.design.widget.TextInputLayout>
Private void login () {String username = t1_username.getEditText (). getText (). toString (); String password = t1_password.getEditText (). getText (). toString (); if (! ValidateUserName (username) {t1_username.setErrorEnabled (true); t1_username.setError ("enter the correct email address");} else if (! ValidatePassword (password) {encrypt (true); t1_password.setError ("too few passwords");} else {t1_username.setErrorEnabled (false); t1_password.setErrorEnabled (false); Toast. makeText (getApplicationContext (), "Login successful", Toast. LENGTH_SHORT ). show ();}}

No4:

Custom Bahavior

The most classic design in CoordinatorLayout is Bahavior. The value of app: layout_behavior = "@ string/appbar_scrolling_view_behavior" corresponds to AppBarLayout. ScrollingViewBehavior.

There are two methods to customize Behavior:

1) The defined View listens to the sliding status in CoordinatorLayout. Note that the onStartNestedScroll () and onNestedPreScroll () methods are rewritten.

2) The defined View listens to the status changes of another View. Note that the layoutDependsOn () and onDependentViewChanged () methods are rewritten.

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.