Snackbar is a new control in Android support Library 22.2.0, similar to the use of toast
How to use
Snackbar Snackbar =snackbar.make (context,"Snack Bar", Snackbar.length_short); Snackbar.show ();
Or
Snackbar.make (Context, message, duration) . Setaction (Action message, click Listener) . Show ();
Method:
- Make () – Generate Snackbar messages
- setaction () – Set action
- Make () – Display Snackbar message
Property:
- The first parameter of the Make () method is a view, and Snackbar will try to find a parent view to hold the view. Snackbar will traverse the entire view tree to find a suitable parent view, which may be a coordinatorlayout or window decor's content view, whichever is the right.
- As mentioned above, the duration parameter is similar to the duration parameter in a toast, only length_short or length_long, and cannot be any other random number.
How to use Android snackbar