toast的用法,工具类的都有什么
在学校安卓的时候,觉得系统默认的弹匣不干净,所以在git上看了道具类。 很漂亮。
https://github.com/grenderg/toasty
步骤:集成:在所有项目中配置
要在all projects { repositories } . maven { URL ' https://JIT pack.io ' } moudle中配置依赖关系:
dependencies {.compile ' com.github.grenderg : toasty :1.1.2 ' }使用方法: 1、展示错误的弹窗:
toasty.error(yourcontext,' This is an error toast.',Toast.LENGTH_SHORT,true ).show );
2、展示成功弹窗:
toasty.Success(yourcontext,' success!' ,Toast.LENGTH_SHORT,true ).show (;
3、展示信息弹匣:
toasty.info(yourcontext,' Here is some info for you.',Toast.LENGTH_SHORT,true ).show );
4、展示警告弹窗:
toasty.warning(yourcontext,' Beware of the dog.',Toast.LENGTH_SHORT,true ).show );
5、展示普通弹匣:
toasty.normal(yourcontext,' Normal toast w/o icon ' ).show ); 6、展示弹匣,定制配套图片:
toasty.normal(yourcontext,' Normal toast w/icon ',yourIconDrawable ).show ); 7、展示弹匣,定制内容及其颜色、背景颜色,图片:
toasty.custom(yourcontext,' I'm a custom Toast ',yourIconDrawable,textColor,tintColor,duration,withIcon,true