How can I crop image to square using picasso library on Android?

我如何在Android上使用毕加索的库来裁剪图像?

I need following: cat one and cat two

我需要跟随:猫1和猫2。

2 个解决方案

#1


1

The following project provides a lot of different transformations for Picasso

下面的项目为毕加索提供了许多不同的转换。

https://github.com/wasabeef/picasso-transformations

https://github.com/wasabeef/picasso-transformations

The one you are interested is named CropSquareTransformation and you can apply it by using the following code

您感兴趣的这个名称叫做CropSquareTransformation,您可以使用下面的代码来应用它。

Picasso.with(mContext)
       .load(R.drawable.demo)
       .transform(transformation)
       .transform(new CropSquareTransformation())
       .into(holder.image);

You could add the dependency or copy and paste the classes you need.

您可以添加依赖项或复制并粘贴您需要的类。

更多相关文章

  1. 在不同状态下使用两个图像切换按钮
  2. POST json和图像到服务器android
  3. Java实现图像对比类
  4. 为可执行文件夹提供自定义图像
  5. 在扑克游戏中显示卡片的图像
  6. 如何获取可绘制图像的ID

随机推荐

  1. PHP变量的初始化以及赋值方式介绍
  2. PHP序列化和反序列化语法差异问题
  3. PHP 编写基本的 Socket 程序
  4. 如何直接访问php实例对象的private属性
  5. 用PHP+Redis实现延迟任务 实现自动取消订
  6. 关于php访问控制的介绍
  7. 解决php使用支付宝SDK报错问题
  8. PHP常见并发场景的解决方法
  9. 系统化理解PHP中的错误和异常
  10. PHP中判断函数是否被定义的方法