Android ImageView在图库中显示模糊图像

Android ImageView在图库中显示模糊图像

问题描述:

我的手机图像库中有高质量的图像。当我尝试将这些文件添加到ImageView时,它显示非常模糊Android ImageView在图库中显示模糊图像

<ImageView 
     android:id="@+id/img_user" 
     android:layout_width="match_parent" 
     android:layout_height="250dp" 
     android:adjustViewBounds="true" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:background="#CCC" 
     android:scaleType="centerCrop" /> 

为什么发生这种情况?

试试你的宽度和高度设置为wrap_content,像这样:

<ImageView 
     android:id="@+id/img_user" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:adjustViewBounds="true" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:background="#CCC" 
     android:scaleType="centerCrop" /> 

或者,如果你需要保持你的ImageView的大小,请尝试使用GlidePicasso,以适应里面的ImageView图像。

删除高度:250dp并将其设置为wrap_content,就是这样吧