android Toast工具BToast

1,引用

implementation 'com.bravin.btoast:BToast:1.0.3'

2,在Application中配置

@Override public void onCreate() {     super.onCreate();      BToast.Config.getInstance()//                .setAnimate() // Whether to startAnimation. default is fasle;//                .setAnimationDuration()// Animation duration. default is 800 millisecond//                .setAnimationGravity()// Animation entering position. default is BToast.ANIMATION_GRAVITY_TOP//                .setDuration()// toast duration  is Either BToast.DURATION_SHORT or BToast.DURATION_LONG//                .setTextColor()// textcolor. default is white//                .setErrorColor()// error style background Color default is red//                .setInfoColor()// info style background Color default is blue//                .setSuccessColor()// success style background Color default is green//                .setWarningColor()// waring style background Color default is orange//                .setLayoutGravity()// whan show an toast with target, coder can assgin position relative to target. default is BToast.LAYOUT_GRAVITY_BOTTOM//                .setLongDurationMillis()// long duration. default is 4500 millisecond//                .setRadius()// radius. default is half of view's height. coder can assgin a positive value//                .setRelativeGravity()// whan show an toast with target, coder can assgin position relative to toastself(like relativeLayout start end center), default is BToast.RELATIVE_GRAVITY_CENTER //                .setSameLength()// sameLength.  whan layoutGravity is BToast.LAYOUT_GRAVITY_TOP or BToast.LAYOUT_GRAVITY_BOTTOM,sameLength mean toast's width is as same as target,otherwise is same height //                .setShortDurationMillis()// short duration. default is 3000 millisecond//                .setShowIcon()// show or hide icon//                .setTextSize()// text size. sp unit             .apply(this);// must call }

3,使用,来展示个success类型的toast

BToast.success(v.getContext())         .text("this is text")         .show();

再来个矩形toast

BToast.success(v.getContext())          .text(R.string.text_test_content)          .radius(0)          .show();

动画版toast

BToast.success(v.getContext())          .text(R.string.text_test_content)          .animate(true)          .show();

更多相关文章

  1. 转:Android实现矩形设置菜单
  2. Android标准Glide加载圆形图和圆角矩形图
  3. Android画圆角矩形图片,并在图片上写字
  4. Android 自定义Drawable 实现圆角矩形和圆形图片
  5. xml中设置圆角矩形框
  6. Android 快速将一个Bitmap变成圆形或圆角矩形 kotlin
  7. android 自定义相机 取矩形内内容 注意事项
  8. canvas.drawRoundRect方法,绘制圆角矩形
  9. a64_7.1-v3.1android拉伸绘制矩形区域距离默认平板外边界问题

随机推荐

  1. Android 处理屏幕解锁和设置锁屏密码
  2. Android捕鱼游戏1.10破解
  3. Google API V2申请及Google Map简单应用
  4. Android中RelativeLayout及TableLayout使
  5. Android屏幕适配之修改系统density
  6. Android service 服务 笔记
  7. Android 读取 短信 信息
  8. Android(安卓)Studio快捷键
  9. android连接数据库
  10. Android驱动入门系列(一)