public class SnackBar extends android.widget.FrameLayout implements ThemeManager.OnThemeChangedListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
SnackBar.OnActionClickListener
Interface definition for a callback to be invoked when action button is clicked.
|
static interface |
SnackBar.OnStateChangeListener
Interface definition for a callback to be invoked when SnackBar's state is changed.
|
android.widget.FrameLayout.LayoutParamsandroid.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListenerandroid.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener| Modifier and Type | Field and Description |
|---|---|
static int |
MATCH_PARENT |
protected int |
mCurrentStyle |
protected int |
mStyleId |
static int |
STATE_DISMISSED
Indicate this SnackBar is already dismissed.
|
static int |
STATE_DISMISSING
Indicate this SnackBar is being dismissed.
|
static int |
STATE_SHOWING
Indicate this SnackBar is being shown.
|
static int |
STATE_SHOWN
Indicate this SnackBar is already shown.
|
static int |
WRAP_CONTENT |
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHEACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z| Constructor and Description |
|---|
SnackBar(android.content.Context context) |
SnackBar(android.content.Context context,
android.util.AttributeSet attrs) |
SnackBar(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr) |
SnackBar(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes) |
| Modifier and Type | Method and Description |
|---|---|
SnackBar |
actionClickListener(SnackBar.OnActionClickListener listener)
Set the listener will be called when the ActionButton is clicked.
|
SnackBar |
actionId(int id)
Set the actionId of this SnackBar.
|
SnackBar |
actionRipple(int resId)
Set the style of RippleEffect of the ActionButton.
|
SnackBar |
actionText(java.lang.CharSequence text)
Set the text that the ActionButton is to display.
|
SnackBar |
actionText(int id)
Set the text that the ActionButton is to display.
|
SnackBar |
actionTextAppearance(int resId)
Sets the text color, size, style of the ActionButton from the specified TextAppearance resource.
|
SnackBar |
actionTextColor(android.content.res.ColorStateList colors)
Set the text color of the ActionButton.
|
SnackBar |
actionTextColor(int color)
Set the text color of the ActionButton for all states.
|
SnackBar |
actionTextSize(float size)
Set the text size of the ActionButton to the given value, interpreted as "scaled pixel" units.
|
SnackBar |
animationIn(android.view.animation.Animation anim)
Set the animation will be shown when SnackBar enter screen.
|
SnackBar |
animationOut(android.view.animation.Animation anim)
Set the animation will be shown when SnackBar exit screen.
|
protected void |
applyStyle(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes) |
SnackBar |
applyStyle(int resId) |
SnackBar |
backgroundColor(int color)
Set the background color of this SnackBar.
|
SnackBar |
backgroundRadius(int radius)
Set the background's corner radius of this SnackBar.
|
void |
dismiss()
Dismiss this SnackBar.
|
SnackBar |
duration(long duration)
Set the duration this SnackBar will be shown before dismissing.
|
SnackBar |
ellipsize(android.text.TextUtils.TruncateAt at)
Causes words in the text that are longer than the view is wide to be ellipsized instead of broken in the middle.
|
int |
getState()
Get the current state of this SnackBar.
|
SnackBar |
height(int height)
Makes this SnackBar exactly this many pixels tall.
|
SnackBar |
horizontalPadding(int padding)
Set the horizontal padding between this SnackBar and it's text and button.
|
SnackBar |
lines(int lines)
Makes the text exactly this many lines tall.
|
static SnackBar |
make(android.content.Context context) |
SnackBar |
marginBottom(int size)
Set the bottom margin between this SnackBar and it's parent.
|
SnackBar |
marginStart(int size)
Set the start margin between this SnackBar and it's parent.
|
SnackBar |
maxHeight(int height)
Makes this SnackBar at most this many pixels tall
|
SnackBar |
maxLines(int lines)
Makes the text at most this many lines tall.
|
SnackBar |
maxWidth(int width)
Makes this SnackBar at most this many pixels wide
|
SnackBar |
minHeight(int height)
Makes this SnackBar at least this many pixels tall
|
SnackBar |
minWidth(int width)
Makes this SnackBar at least this many pixels wide
|
protected void |
onAttachedToWindow() |
protected void |
onDetachedFromWindow() |
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b) |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec) |
void |
onRtlPropertiesChanged(int layoutDirection) |
void |
onThemeChanged(ThemeManager.OnThemeChangedEvent event) |
SnackBar |
padding(int horizontalPadding,
int verticalPadding)
Set the padding between this SnackBar and it's text and button.
|
SnackBar |
removeOnDismiss(boolean b)
Indicate that this SnackBar should remove itself from parent view after being dismissed.
|
void |
show()
Show this SnackBar.
|
void |
show(android.app.Activity activity)
Show this SnackBar.
|
void |
show(android.view.ViewGroup parent)
Show this SnackBar.
|
SnackBar |
singleLine(boolean b)
Sets the text will be single-line or not.
|
SnackBar |
stateChangeListener(SnackBar.OnStateChangeListener listener)
Set the listener will be called when this SnackBar's state is changed.
|
SnackBar |
text(java.lang.CharSequence text)
Set the text that this SnackBar is to display.
|
SnackBar |
text(int id)
Set the text that this SnackBar is to display.
|
SnackBar |
textAppearance(int resId)
Sets the text color, size, style from the specified TextAppearance resource.
|
SnackBar |
textColor(int color)
Set the text color.
|
SnackBar |
textSize(float size)
Set the text size to the given value, interpreted as "scaled pixel" units.
|
SnackBar |
verticalPadding(int padding)
Set the vertical padding between this SnackBar and it's text and button.
|
SnackBar |
width(int width)
Makes this SnackBar exactly this many pixels wide.
|
checkLayoutParams, draw, drawableHotspotChanged, drawableStateChanged, gatherTransparentRegion, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getConsiderGoneChildrenWhenMeasuring, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getMeasureAllChildren, jumpDrawablesToCurrentState, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onSizeChanged, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setMeasureAllChildren, setVisibility, shouldDelayChildPressedState, verifyDrawableaddChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawChild, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onStartNestedScroll, onStopNestedScroll, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayoutaddFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDraw, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPopulateAccessibilityEvent, onRestoreInstanceState, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDrawclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcanResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindows, requestLayoutprotected int mStyleId
protected int mCurrentStyle
public static final int MATCH_PARENT
public static final int WRAP_CONTENT
public static final int STATE_DISMISSED
public static final int STATE_SHOWN
public static final int STATE_SHOWING
public static final int STATE_DISMISSING
public SnackBar(android.content.Context context)
public SnackBar(android.content.Context context,
android.util.AttributeSet attrs)
public SnackBar(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr)
public SnackBar(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
public static SnackBar make(android.content.Context context)
public SnackBar applyStyle(int resId)
protected void applyStyle(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
public void onThemeChanged(ThemeManager.OnThemeChangedEvent event)
onThemeChanged in interface ThemeManager.OnThemeChangedListenerprotected void onAttachedToWindow()
onAttachedToWindow in class android.view.ViewGroupprotected void onDetachedFromWindow()
onDetachedFromWindow in class android.view.ViewGrouppublic void onRtlPropertiesChanged(int layoutDirection)
onRtlPropertiesChanged in class android.view.Viewprotected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
onMeasure in class android.widget.FrameLayoutprotected void onLayout(boolean changed,
int l,
int t,
int r,
int b)
onLayout in class android.widget.FrameLayoutpublic SnackBar text(java.lang.CharSequence text)
text - The text is displayed.public SnackBar text(int id)
id - The resourceId of text is displayed.public SnackBar textColor(int color)
color - The color of text.public SnackBar textSize(float size)
size - The size of text.public SnackBar textAppearance(int resId)
resId - The resourceId value.public SnackBar ellipsize(android.text.TextUtils.TruncateAt at)
at - public SnackBar singleLine(boolean b)
b - public SnackBar maxLines(int lines)
lines - The maximum line value.public SnackBar lines(int lines)
lines - The line number.public SnackBar actionId(int id)
id - The actionId value.public SnackBar actionText(java.lang.CharSequence text)
text - If null, then the ActionButton will be hidden.public SnackBar actionText(int id)
id - If 0, then the ActionButton will be hidden.public SnackBar actionTextColor(int color)
color - The color of text.public SnackBar actionTextColor(android.content.res.ColorStateList colors)
colors - public SnackBar actionTextAppearance(int resId)
resId - The resourceId value.public SnackBar actionTextSize(float size)
size - The size of text.public SnackBar actionRipple(int resId)
resId - The resourceId of RippleEffect.public SnackBar duration(long duration)
duration - If 0, then the SnackBar will not be dismissed until dismiss() is called.public SnackBar backgroundColor(int color)
color - The color of background.public SnackBar backgroundRadius(int radius)
radius - The corner radius.public SnackBar horizontalPadding(int padding)
padding - public SnackBar verticalPadding(int padding)
padding - public SnackBar padding(int horizontalPadding, int verticalPadding)
horizontalPadding - The horizontal padding.verticalPadding - The vertical padding.public SnackBar width(int width)
width - The width value in pixels.public SnackBar minWidth(int width)
width - The minimum width value in pixels.public SnackBar maxWidth(int width)
width - The maximum width value in pixels.public SnackBar height(int height)
height - The height value in pixels.public SnackBar maxHeight(int height)
height - The maximum height value in pixels.public SnackBar minHeight(int height)
height - The maximum height value in pixels.public SnackBar marginStart(int size)
size - public SnackBar marginBottom(int size)
size - public SnackBar actionClickListener(SnackBar.OnActionClickListener listener)
listener - The SnackBar.OnActionClickListener will be called.public SnackBar stateChangeListener(SnackBar.OnStateChangeListener listener)
listener - The SnackBar.OnStateChangeListener will be called.public SnackBar animationIn(android.view.animation.Animation anim)
anim - The animation.public SnackBar animationOut(android.view.animation.Animation anim)
anim - The animation.public SnackBar removeOnDismiss(boolean b)
b - public void show(android.app.Activity activity)
activity - public void show(android.view.ViewGroup parent)
parent - Must be or RelativeLayoutpublic void show()
public void dismiss()
STATE_SHOWN to be dismissed.public int getState()
STATE_DISMISSED, STATE_DISMISSING, STATE_SHOWING or STATE_SHOWN.