|
|
@@ -211,6 +211,25 @@ public final class Crouton {
|
|
|
return new Crouton(activity, text, style, viewGroup);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自定义设置背景色,延时时间
|
|
|
+ * @param activity
|
|
|
+ * @param text
|
|
|
+ * @param color
|
|
|
+ * @param time
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static Crouton makeText(Activity activity,int height, CharSequence text, int color, int time){
|
|
|
+ Style customColor = new Style.Builder().setBackgroundColorValue(color)
|
|
|
+ .setHeight(
|
|
|
+ (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
|
|
+ height,
|
|
|
+ activity.getResources().getDisplayMetrics())
|
|
|
+ ).build();
|
|
|
+ Configuration customConfiguration = new Configuration.Builder().setDuration(time).build();
|
|
|
+ return new Crouton(activity, text, customColor).setConfiguration(customConfiguration);
|
|
|
+ }
|
|
|
/**
|
|
|
* 自定义设置背景色,延时时间
|
|
|
*
|