毕加索作物视图 [英] Picasso crop to a view

查看:178
本文介绍了毕加索作物视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何使用毕加索将图像裁剪到ImageView的?

How would I use picasso to crop an image to an imageview?

默认似乎它的规模下来,整个事情秀
拟合似乎拉伸它。
centercrop本身打破。
适合centercrop似乎是因为正好契合相同

Default seems to scale it down so the whole thing shows fit seems to stretch it. centercrop by itself breaks. fit centercrop seems to be the same as just fit

感谢

推荐答案

尝试使用 centerCrop()

Picasso.with(mContext)
.load(url)
.centerCrop()
.resize(yourImageView.getMeasuredWidth(),yourImageView.getMeasuredHeight())
.error(R.drawable.error)
.placeholder(R.drawable.blank_img)
.into(yourImageView);

您必须添加插件preDrawListener 监听器,否则你会得到0宽度和高度时,不绘制的ImageView的。去这里如何使用插件preDrawListener 详细

You have to add addOnPreDrawListener listener otherwise you will get 0 for width and height when the imageview is not drawn. Go here for details on how to use addOnPreDrawListener.

这篇关于毕加索作物视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆