2
A
回答
1
以下项目提供了很多不同的转换为毕加索
https://github.com/wasabeef/picasso-transformations
一个你感兴趣的是名为CropSquareTransformation
,您可以通过应用它使用以下代码
Picasso.with(mContext)
.load(R.drawable.demo)
.transform(transformation)
.transform(new CropSquareTransformation())
.into(holder.image);
您可以添加依赖项或复制并粘贴所需的类。
+1
谢谢!这正是我需要的! –
0
使用自定义的ImageView:
public class SquareImageView extends android.support.v7.widget.AppCompatImageView {
public SquareImageView(Context context) {
super(context);
}
public SquareImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquareImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth()); //Snap to width
}
}
在你的XML:
<com.my.package.SquareImageView
android:layout_width="match_parent"
android:layout_height="wrap_content">
相关问题
- 1. 没有裁剪的毕加索圆变换图片
- 2. 加载图像与毕加索
- 3. 图像裁剪与codeigniter
- 4. 裁剪图像
- 5. 裁剪图像
- 6. 裁剪后的图像不能与tess-two一起使用
- 7. 无法剪裁/裁剪图像
- 8. PHP裁剪不起作用,返回黑色图像 - 图像裁剪系统
- 9. 毕加索重复图像
- 10. WPF图像裁剪
- 11. html5图像裁剪
- 12. WPF图像裁剪
- 13. 笨裁剪图像
- 14. 裁剪android图像
- 15. GWT图像裁剪
- 16. Silverlight图像裁剪
- 17. 裁剪YUV图像
- 18. raphael.js裁剪图像
- 19. 裁剪后无法检索图像Android
- 20. 像facebook一样的图像裁剪
- 21. OpenCV裁剪图像与椭圆
- 22. 在Python中裁剪图像:Image.crop()与Image.transform()?
- 23. 图像裁剪与GDI呈现+
- 24. 如何加载与毕加索aws图像与私人访问
- 25. 实施毕加索不加载图像
- 26. 毕加索图像未加载Gridview Android
- 27. 从毕加索添加图像到Gridview
- 28. 回收毕加索图像加载器
- 29. 毕加索图书馆和GridView图像
- 30. 响应图像裁剪
这个问题已经在这里找到答案,也许它可以帮助:http://stackoverflow.com/questions/30134438/ picasso-crop-to-a-view – rontho