Hey everyone I have been running into an issue with Picasso. I am trying to load an image from sound cloud but it keeps appearing stretched or very small. Here is my XML
<ImageView
android:id="@+id/album_cover_art"
android:layout_width="300dp"
android:layout_height="200dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/fragment_content_item_top_margin"
android:scaleType="centerInside"
android:contentDescription="@string/content_description_image_placeholder"
android:src="@drawable/placeholder" />
I tried to use picasso's resize and center inside but the image appears small.
Picasso.with(getContext()).load(mSelectedTrack.getArtworkURL()).resize(800,300).centerInside().into(mAlbumCoverArt);
Using picasso's resize and center crop maintains the image view size but leads to the image appearing stretched.
Picasso.with(getContext()).load(mSelectedTrack.getArtworkURL()).resize(800,300).centerCrop().into(mAlbumCoverArt);
Any ideas on a way to do this that is easier than writing a function to resize it myself ?
I avoided image stretching using :
.resize(800,0)
Passing 0 as second parameter it preserved the image proportions.
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With