1

当用户点击列表中的一篇文章,被带到文章详情页面(普通的“阅读文章”类型页面),图片区域很小,然后,当图片加载时,它会弹出更大......就像 HTML 一样,如果您忘记指定高度和宽度。

我将原始图像的高度和宽度保留在我的 sqlite 数据库中。我可以使用此信息以某种方式提前设置比率,以便在页面加载时不会改变内容吗?

注意:我目前正在询问有关全角文章图像的最佳 XML 的另一个相关问题: Photo: wrap_content, but max_width = layout width

是否值得为这种事情弄乱代码,或者只是将其留给 XML 并接受内容转换?

我当前用于 imageView 的 XML:

        <ImageView
            android:id="@+id/article_photo"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@color/super_light_gray"
            android:scaleType="centerCrop"
            android:contentDescription="@string/articlePhoto"
            android:cropToPadding="true"
            android:layout_marginBottom="20dp"
            android:padding="1dp"/>
4

0 回答 0