我对android中图片的处理有很多疑惑,希望你能解决。
此时,我有一张图像,其高度为 320 dp,宽度为 match_parent,大约占屏幕的 60%。 这张使用 Glide 加载的图像,我个人拥有的一些 1080 图像。
我尝试制作 centroCrop 和 fitXY,但总是使图像变形。我知道的第一种类型会剪切图像,但第二种类型适合某个尺寸,但它确实会使图像变高或变宽。
有什么办法可以用 Glide 插入它并按原样查看吗? 我需要触及 ImageView 的哪些属性以及 Glide 的哪些属性?
<ImageView
android:id="@+id/img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"
app:layout_collapseMode="parallax"
android:scaleType="fitXY"
app:layout_scrollFlags="scroll|enterAlways" />
最佳答案
Override
必须在最新版本的 Glide 4.x
中通过 RequestOptions
访问。您可以通过apply()
RequestOptions
Glide.with(context)
.load(path)
.apply(new RequestOptions().override(600, 200))
.into(imageViewResizeCenterCrop);
关于android - 在 ImageView Android 中使用 Glide 调整图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46114603/