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.