美文网首页
图片的加载

图片的加载

作者: alialiali | 来源:发表于2017-04-30 21:11 被阅读0次

转载【商明超的博客】:http://blog.csdn.net/shangmingchao
Glide使用详解(一)
http://blog.csdn.net/shangmingchao/article/details/51125554
Glide使用详解(二)
http://blog.csdn.net/shangmingchao/article/details/51172972
glide的基本使用以及原理
http://blog.csdn.net/hshshshshs1/article/details/50786203
(一)Glide.with(……) 可以传入的参数有
with(Android.app.Activity)
with(android.app.Fragment)*
with(android.support.v4.app.Fragment)*
with(android.support.v4.app.FragmentActivity)
(二)占位符使用
placeholder(R.mipmap.ic_launcher) // can also be a drawable
总结:1.你不能设置一个网络 url 作为占位符,因为这也会被去请求加载的。
2.load()里面,Glide接受所有的值(可以是本地的资源也可以是网络上的资源)。
(三)错误占位符
error(R.mipmap.future_studio_launcher)
// will be displayed if the image cannot be loaded
(四)使用 crossFade()
crossFade() 方法还有另外重载方法 .crossFade(int duration)。
如果你想要去减慢(或加快)动画,随时可以传一个毫秒的时间给这个方法。
动画默认的持续时间是 300毫秒。
(五)使用 dontAnimate()
直接显示你的图片,而不是淡入显示到 ImageView
(六)用 override(horizontalSize, verticalSize) 调整图片大小
(七)缩放图像
CenterCrop
CenterCrop()是一个裁剪技术,即缩放图像让它填充到 ImageView 界限内并且侧键额外的部分。ImageView 可能会完全填充,但图像可能不会完整显示。
FitCenter
fitCenter() 是裁剪技术,即缩放图像让图像都测量出来等于或小于 ImageView 的边界范围。该图像将会完全显示,但可能不会填满整个 ImageView。

相关文章

网友评论

      本文标题:图片的加载

      本文链接:https://www.haomeiwen.com/subject/nxwxtxtx.html