Snackbar

suggest change

Versions

This topic was documented against Android 3.0.x through 7.1.

Syntax

Parameters

Parameter Description
view View: The view to find a parent from.
text CharSequence: The text to show. Can be formatted text.
resId int: The resource id of the string resource to use. Can be formatted text.
duration int: How long to display the message. This can be LENGTH_SHORT, LENGTH_LONG, or LENGTH_INDEFINITE.

Remarks

Snackbar provides lightweight feedback about an operation. It displays a brief message at the bottom of the screen on mobile and at the bottom left on larger devices. Snackbars appear above all other elements on the screen and only one can be displayed at a time.

They automatically disappear after a timeout or after user interaction elsewhere on the screen, particularly after interactions that summon a new surface or activity. Snackbar can be swiped off screen.

Before using Snackbar you must add the design support library dependency in the build.gradle file:

dependencies {
    compile 'com.android.support:design:25.3.1'
}

Official Documentation

https://developer.android.com/reference/android/support/design/widget/Snackbar.html

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents