0
私はサービスからイメージをロードするためにPicasso
ライブラリを使用しています。そのうまく動作します。しかし、scroll
の画像が下にスクロールアップされている間に、画像はのレイアウトでrecyclerview
を使用して伸ばされました。イメージピカソを使用して伸ばした
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/bg_image_layout"
android:layout_width="match_parent"
android:layout_height="175dp"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/bg_image"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@mipmap/ic_launcher" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="center"
android:id="@+id/img_logo"
android:src="@drawable/logo"
android:layout_below="@id/bg_image_layout"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
:
Picasso.with(context)
.load(items.get(position).getBgImage())
.placeholder(R.mipmap.ic_launcher)
.fit()
.centerCrop()
.into(shopViewHolder.bgImage);
いずれかが私を助けることができることができます..私はここで間違っていたところ...
画像を伸ばすことなく表示する必要があるので、この問題を解決するために使用する必要がありますか? – user
'.fit()'と '.centerCrop()'を削除して '。 centerInside() ' '.resize(int、int)'も設定できます。私はテストしていませんが、それはあなたが必要とすることを行う必要があります。アスペクト比の維持に関する詳細はこちら:https://github.com/square/picasso/issues/226 – Knossos
スクロールすると、画像ビューのスケールタイプのみが使用されます。 – user