Toasty
介绍:
带图标提示的Toast控件,简洁大方。
运行效果:
使用说明:
在项目的build.gradle中添加:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
在module的build.gradle中添加:
dependencies {
...
compile 'com.github.GrenderG:Toasty:1.1'
}
显示错误信息的Toast:
Toasty.error(yourContext, "This is an error toast.", Toast.LENGTH_SHORT, true).show();
显示成功的Toast:
Toasty.success(yourContext, "Success!", Toast.LENGTH_SHORT, true).show();
显示info的Toast:
Toasty.info(yourContext, "Here is some info for you.", Toast.LENGTH_SHORT, true).show();
显示警告的Toast:
Toasty.warning(yourContext, "Beware of the dog.", Toast.LENGTH_SHORT, true).show();
显示常规的Toast:
Toasty.normal(yourContext, "Normal toast w/o icon").show();
带图标的常规Toast :
Toasty.normal(yourContext, "Normal toast w/ icon", yourIconDrawable).show();
还可以使用custom()方法自定义Toast:
Toasty.custom(yourContext, "I'm a custom Toast", yourIconDrawable, textColor, tintColor, duration, withIcon, true).show();
已下载
0