Android Glide 图像加载库显示模糊图像

标签 android gridview android-glide image-loading

我知道有人问过这个问题,但他们的回答并没有解决我的问题。

我在 GridView 中使用 Glide

GridView显示图片时是这样的

enter image description here

我一直在等待,但什么都没有改变。然后滚动 GridView 后,所有图像突然出现,如下所示。

enter image description here

那么,如何在不滚动的情况下获得质量更好的图像?这个问题有其他解决方案吗?

我的Glide代码是这样写的

 Glide.with(activity)
                .load(R.drawable.xyz)
                .crossFade()
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .placeholder(R.drawable.img_hold)
                .into(imgView);

最佳答案

发现问题。图像变得模糊或像素化是因为您没有像这样在我的 ImageView 中设置固定宽度值:

android:layout_width="wrap_content"
android:layout_height="100dp"

在我像这样给它一个固定值之后:

android:layout_width="170dp"
android:layout_height="100dp"

所有图像都很好地加载。

但我已经在 picasso lib 上进行了测试,尽管使用了 android:layout_width="wrap_content"

,但它们可以很好地加载所有图像

关于Android Glide 图像加载库显示模糊图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38712062/

相关文章:

java - 如何在 Vaadin View 中的网格/表格中设置单元格背景颜色?

android - 如何在 glide 4 中为圆形裁剪图像制作阴影

android - 在 Recyclerview 中使用 Glide 发出警告

android - 如何在gradle中强制下载aar版本的依赖项

android - 标签 View 可以在 fragment 中使用吗

android - Android 中的自定义文件扩展名

java - 当我尝试加载数据库时应用程序不断崩溃

ASP.NET GridView 对计算字段进行排序

asp.net - 无法在 gridview 控件上设置行高

android - 如何截取 Android 的 Surface View 的屏幕截图?