【问题标题】:Android ImageView Showing Blurry Images in GalleryAndroid ImageView 在图库中显示模糊的图像
【发布时间】:2017-04-21 10:19:13
【问题描述】:

我的手机图片库中有高质量的图片。当我尝试将这些文件添加到 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" />

为什么会这样?

【问题讨论】:

    标签: android imageview blurry


    【解决方案1】:

    尝试将宽度和高度设置为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。

    【讨论】:

      【解决方案2】:

      移除高度 : 250dp 并将其设为 wrap_content 即可

      【讨论】:

        猜你喜欢
        • 2020-04-22
        • 1970-01-01
        • 1970-01-01
        • 2015-03-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多