【发布时间】:2017-10-24 16:55:19
【问题描述】:
大家好,我遇到了毕加索的问题。我正在尝试从声音云加载图像,但它一直显得拉伸或非常小。这是我的 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" />
我尝试在内部使用 picasso 的调整大小和居中,但图像看起来很小。
Picasso.with(getContext()).load(mSelectedTrack.getArtworkURL()).resize(800,300).centerInside().into(mAlbumCoverArt);
使用 picasso 的调整大小和中心裁剪可以保持图像视图大小,但会导致图像看起来被拉伸。
Picasso.with(getContext()).load(mSelectedTrack.getArtworkURL()).resize(800,300).centerCrop().into(mAlbumCoverArt);
有什么比自己编写函数来调整大小更容易的方法吗?
【问题讨论】: