【问题标题】:Picasso's .fit() is off by some pixels毕加索的 .fit() 偏离了一些像素
【发布时间】:2015-02-28 17:29:07
【问题描述】:

我有一个 ImageView 固定 layout_heightlayout_width 和一个在它的背景中的框架(代码如下)。

我想使用 picasso 将图像加载到其中并使图像适合 ImageView 边界。

我的ImageView

<ImageView
            android:id="@+id/upload_photo_row_image"
            android:layout_width="99dp"
            android:layout_height="72dp"
            android:background="@drawable/background_photo_frame"
            android:padding="4dp"/>

background_photo_frame

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@android:color/transparent"/>
    <stroke
        android:width="4 dp"
        android:color="@color/pure_white"/>
</shape>

毕加索加载代码:

Picasso.with(getContext()).load(uri).fit().centerCrop().into(imageView)

毕加索版:

compile 'com.squareup.picasso:picasso:2.5.0'

使用此代码,图像的宽度比应有的要小一些,如下图所示(包含 ViewGroupbackground_color 已设置为红色以说明错误):

我可以修复这个问题,将属性android:scaleType="fitXY" 添加到我的ImageView。是我做错了什么还是Picasso 中的错误?

【问题讨论】:

    标签: android imageview scale picasso


    【解决方案1】:

    你用的是什么版本?这应该在最新版本中修复(截至 2015 年 2 月 28 日的 2.5.0)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-08
      • 1970-01-01
      • 1970-01-01
      • 2020-02-13
      • 2018-05-25
      相关资源
      最近更新 更多