5.Glide使用之图片调整大小和缩放

来源:互联网 发布:福建 土豪 知乎 编辑:程序博客网 时间:2024/06/16 00:00

通常来讲,这是最佳的如果您的服务器提供的图像是你需要准确的尺寸,这是一个完美的带宽、内存消耗和图像质量之间的平衡。
override(horizontalSize, verticalSize)

Glide    .with(context)    .load(UsageExampleListViewAdapter.eatFoodyImages[0])    .override(600, 200) // resizes the image to these dimensions (in pixel). does not respect aspect ratio    .into(imageViewResize);

CenterCrop()

Glide    .with(context)    .load(UsageExampleListViewAdapter.eatFoodyImages[0])    .override(600, 200) // resizes the image to these dimensions (in pixel)    .centerCrop() // this cropping technique scales the image so that it fills the requested bounds and then crops the extra.    .into(imageViewResizeCenterCrop);

FitCenter()

Glide    .with(context)    .load(UsageExampleListViewAdapter.eatFoodyImages[0])    .override(600, 200)    .fitCenter()     .into(imageViewResizeFitCenter);
0 0
原创粉丝点击