自定义漂亮的toast

来源:互联网 发布:再也没有 知乎 编辑:程序博客网 时间:2024/05/16 08:05

使用

显示一个错误消息:

Toasty.error(yourContext, "This is an error toast.", Toast.LENGTH_SHORT, true).show();

显示成功消息:

Toasty.success(yourContext, "Success!", Toast.LENGTH_SHORT, true).show();

显示提示消息:

Toasty.info(yourContext, "Here is some info for you.", Toast.LENGTH_SHORT, true).show();

显示警告消息:

Toasty.warning(yourContext, "Beware of the dog.", Toast.LENGTH_SHORT, true).show();

显示不带图标的消息:

Toasty.normal(yourContext, "Normal toast w/o icon").show();

显示带自定义图标的消息:

Toasty.normal(yourContext, "Normal toast w/ icon", yourIconDrawable).show();

显示自定义消息:

Toasty.custom(yourContext, "I'm a custom Toast", yourIconDrawable, textColor, tintColor, duration, withIcon, true).show();

demo下载http://download.csdn.net/detail/qq_35549248/9847624