我在使用Picasso库
时遇到了一个简单的问题。我没有找到任何方法可以将图像放入ImageView
中心,就像 android:ScaleType = "center"
一样,而不会裁剪。你有什么关于如何解决这个问题的想法吗?我的问题是我不知道我下载的BitMap
的高度和宽度,在运行时无法正确使用resize()
。
我在使用Picasso库
时遇到了一个简单的问题。我没有找到任何方法可以将图像放入ImageView
中心,就像 android:ScaleType = "center"
一样,而不会裁剪。你有什么关于如何解决这个问题的想法吗?我的问题是我不知道我下载的BitMap
的高度和宽度,在运行时无法正确使用resize()
。
Picasso
.with(context)
.load(ImageURL)
.fit()
// call .centerInside() or .centerCrop() to avoid a stretched image
.into(imageViewFit);
ImageView
在一个维度上是固定的,而在另一个维度上是灵活的(例如android:width="match_parent"
,android:height="wrap_content"
),那么你应该能够使用android:adjustViewBounds="true"
来调整ImageView
大小,以便显示图像而不进行裁剪。我无法在不调整大小的情况下居中显示
Picasso.get()
.load(source).resize(1650,700)
.centerCrop(Gravity.CENTER).into(imageView, new Callback()