Glide使用详细标注

Glide使用详细标注

Android Studio用户
使用glide首先是builde.gradle添加依赖

 compile 'com.github.bumptech.glide:glide:3.7.0'

eclipse用户可以glide提供jar文件,提供下载链接

https://github.com/kekegdsz/glide/blob/master/glide-3.7.0.jar

使用很简单,这是详细标注

         //Glide使用
        Glide.with(this)
                .load(R.drawable.image)  //设置要加载的内容
                .placeholder(R.color.loading_color)//设置加载中的图片
                .error(R.mipmap.ic_launcher)   //设置加载出错时显示的图片
                .priority(Priority.NORMAL)  //设置请求加载优先级,Priority 里面是使用枚举的形式的
//                .animate()  //设置资源加载完成后的动画,不包矿从内存取出
//                .dontAnimate()  //移除默认淡入淡出动画
                .crossFade()  //加入默认的淡入淡出动画效果
//                .crossFade(100)  //设置默认淡入淡出动画的持续时间
                //加载监听
                .listener(new RequestListener<Integer, GlideDrawable>() {
                    @Override
                    public boolean onException(Exception e, Integer model, Target<GlideDrawable> target, boolean isFirstResource) {
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(GlideDrawable resource, Integer model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                        return false;
                    }
                })
                .centerCrop()  //缩放图片  fitCenter
                .diskCacheStrategy( DiskCacheStrategy.NONE )  //设置是否跳过磁盘缓存  枚举类型all:缓存源资源和转换后的资源   none:不作任何磁盘缓存 source:缓存源资源    result:缓存转换后的资源
                .skipMemoryCache(false)   //设置是否跳过内存缓存
//                .override(100,100) //设置加载宽高
                .into(imageView);  //加载容器
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值