在ImageView Android中使用Glide调整图像大小 [英] Resize images with Glide in a ImageView Android
问题描述
我对android中图像的处理有很多疑问,我希望看看你是否可以解决它们。
I have a lot of doubts about the treatment of the images in android, and I was hoping to see if you could solve them.
此时此刻我有占用320 dp高的图像和match_parent宽度,大约是屏幕的60%。
这张带有Glide的载荷的图像,我个人的1080中的一些图像。
At this point I have an image that occupies 320 dp high, and match_parent width, which is around 60% of the screen. This image of the load with Glide, of some images in 1080 that I have personally.
我试图制作centroCrop和fitXY,但总是使图像变形。我知道的第一种类型会剪切图像,但第二种类型会适合一个尺寸,但它会使图像变高或变宽。
I tried to make centroCrop and fitXY, but always deform the images. The first type I know cuts the image, but the second one fits a size, but it does deform the image high or wide.
有没有办法插入它滑翔并看到它是什么?
我要在ImageView和Glide中触摸哪些属性?
Is there any way, to insert it with Glide and see it as it is? What properties have I to touch on ImageView and which of 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" />
提前致谢。
推荐答案
Elletlar 评论:
必须访问覆盖
通过 RequestOptions
在最新版本的 Glide
。
Glide
.with(context)
.load(path)
.apply(new RequestOptions().override(600, 200))
.into(imageViewResizeCenterCrop);
这篇关于在ImageView Android中使用Glide调整图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!