【问题标题】:Why Picasso is resizing image in Android?为什么毕加索在 Android 中调整图像大小?
【发布时间】:2018-04-07 13:14:45
【问题描述】:

我正在使用 Picasso 从 url 加载图像,但它会自动调整我的图像大小。我正在使用以下调用:

Picasso.with(getContext())
            .load(url)
            .placeholder(R.drawable.placeholder)
            .into(imgView);

无论 Picasso 调整大小对我来说都很好,但由于这种行为,我无法确定占位符图像的大小。

原始图像大小为 w=185 & h=278,我的占位符图像也是如此。 我应该如何决定占位符图片的大小?

布局如下:

        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:id="@+id/image"
                android:src="@drawable/sample_0" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="10dp"
                android:orientation="vertical"
                android:padding="5dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="2015-05-14"
                    android:textSize="30sp" />

            </LinearLayout>

   </LinearLayout>

【问题讨论】:

  • 我认为最好将imgView的大小固定为185x278。
  • 你能分享你ImageView的布局参数吗?
  • 我的 ImageView 在线性布局内。

标签: android image picasso


【解决方案1】:

请将您的毕加索版本更新到最新版本。

implementation 'com.squareup.picasso:picasso:2.71828'

Picasso.get().load(galleryList[position].mediaUrl)
                .placeholder(R.mipmap.ic_launcher).into(holder?.ivImags)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-08
    • 1970-01-01
    • 2016-10-26
    • 1970-01-01
    • 2014-03-20
    相关资源
    最近更新 更多