Class SnackbarAdapter



  • public class SnackbarAdapter
    extends java.lang.Object
    Definition of a Snackbar adapter that will make the snackbar match the full width of the parent.
    • Constructor Summary

      Constructors 
      Constructor and Description
      SnackbarAdapter() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static Snackbar make(View view, int resId, int duration)
      Make a Snackbar to display a message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SnackbarAdapter

        public SnackbarAdapter()
    • Method Detail

      • make

        public static Snackbar make(View view,
                                    int resId,
                                    int duration)
        Make a Snackbar to display a message.

        This snackbar will be full width of the parent. Snackbar will try and find a parent view to hold Snackbar's view from the value given to view. Snackbar will walk up the view tree trying to find a suitable parent, which is defined as a CoordinatorLayout or the window decor's content view, whichever comes first.

        Having a CoordinatorLayout in your view hierarchy allows Snackbar to enable certain features, such as swipe-to-dismiss and automatically moving of widgets like FloatingActionButton.
        Parameters:
        view - The view to find a parent from.
        resId - The resource id of the string resource to use. Can be formatted text.
        duration - How long to display the message. Either or Snackbar#LENGTH_LONG or Snackbar#LENGTH_INDEFINITE
        Returns:
        snackbar instance of Snackbar or null if error occured