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 Rect的使用
  3. android onFling 事件没有用
  4. Android图片缓存加强版(LruCache+DiskLruCache+软引用)
  5. 赵雅智_Android的getResources()资源引用
  6. Android(安卓)shape中的padding无效
  7. 通过Titanium Studio为Android(安卓)APK签名
  8. 转:Android实现矩形设置菜单
  9. Android(安卓)Drawable 详解(教你画画!)

随机推荐

  1. Android(安卓)NDK开发之旅(5):Android(安
  2. Unity3D之坐标系的转换
  3. 数据结构之哈希表
  4. 基于业务和平台理解数字营销概念
  5. 打卡学习
  6. Plotly中4种文本类型设置详解
  7. 裸辞,杀回一线!
  8. Ansible 之 自动化部署redis主从(单机)
  9. 小鹿又熬肝写了一份 Vue 2.0 核心原理!
  10. 《Python知识手册》更新V2.2版,添加 Plotl