public class SnackbarUtils
extends java.lang.Object
author: Blankj blog : http://blankj.com time : 2016/10/16 desc : Snackbar相关工具类
Modifier and Type | Method and Description |
---|---|
static void |
addView(int layoutId,
int index)
为snackbar添加布局
|
static void |
dismissSnackbar()
取消snackbar显示
|
static void |
showIndefiniteSnackbar(View parent,
java.lang.CharSequence text,
int textColor,
int bgColor)
显示自定义时长snackbar
|
static void |
showIndefiniteSnackbar(View parent,
java.lang.CharSequence text,
int textColor,
int bgColor,
java.lang.CharSequence actionText,
int actionTextColor,
View.OnClickListener listener)
显示自定义时长snackbar
|
static void |
showLongSnackbar(View parent,
java.lang.CharSequence text,
int textColor,
int bgColor)
显示长时snackbar
|
static void |
showLongSnackbar(View parent,
java.lang.CharSequence text,
int textColor,
int bgColor,
java.lang.CharSequence actionText,
int actionTextColor,
View.OnClickListener listener)
显示长时snackbar
|
static void |
showShortSnackbar(View parent,
java.lang.CharSequence text,
int textColor,
int bgColor)
显示短时snackbar
|
static void |
showShortSnackbar(View parent,
java.lang.CharSequence text,
int textColor,
int bgColor,
java.lang.CharSequence actionText,
int actionTextColor,
View.OnClickListener listener)
显示短时snackbar
|
public static void showShortSnackbar(View parent, java.lang.CharSequence text, int textColor, int bgColor)
parent
- 父视图(CoordinatorLayout或者DecorView)text
- 文本textColor
- 文本颜色bgColor
- 背景色public static void showShortSnackbar(View parent, java.lang.CharSequence text, int textColor, int bgColor, java.lang.CharSequence actionText, int actionTextColor, View.OnClickListener listener)
parent
- 父视图(CoordinatorLayout或者DecorView)text
- 文本textColor
- 文本颜色bgColor
- 背景色actionText
- 事件文本actionTextColor
- 事件文本颜色listener
- 监听器public static void showLongSnackbar(View parent, java.lang.CharSequence text, int textColor, int bgColor)
parent
- 视图(CoordinatorLayout或者DecorView)text
- 文本textColor
- 文本颜色bgColor
- 背景色public static void showLongSnackbar(View parent, java.lang.CharSequence text, int textColor, int bgColor, java.lang.CharSequence actionText, int actionTextColor, View.OnClickListener listener)
parent
- 视图(CoordinatorLayout或者DecorView)text
- 文本textColor
- 文本颜色bgColor
- 背景色actionText
- 事件文本actionTextColor
- 事件文本颜色listener
- 监听器public static void showIndefiniteSnackbar(View parent, java.lang.CharSequence text, int textColor, int bgColor)
parent
- 父视图(CoordinatorLayout或者DecorView)text
- 文本textColor
- 文本颜色bgColor
- 背景色public static void showIndefiniteSnackbar(View parent, java.lang.CharSequence text, int textColor, int bgColor, java.lang.CharSequence actionText, int actionTextColor, View.OnClickListener listener)
parent
- 父视图(CoordinatorLayout或者DecorView)text
- 文本textColor
- 文本颜色bgColor
- 背景色actionText
- 事件文本actionTextColor
- 事件文本颜色listener
- 监听器public static void addView(int layoutId, int index)
在show...Snackbar之后调用
layoutId
- 布局文件index
- 位置(the position at which to add the child or -1 to add last)public static void dismissSnackbar()