【问题标题】:Change image size without stretching在不拉伸的情况下更改图像大小
【发布时间】:2014-04-07 15:01:08
【问题描述】:

这是我从服务器获取的图像。

这是我调整大小的图像。

我的ImageView 高度始终为120dp,宽度为fill_parent。我从服务器获取 1024*1024 像素的图像。如何在不拉伸的情况下更改图像以在我的ImageView 中设置?我已经解决了onetwothree等。但我得到了可拉伸的图像。 给出一些想法来解决这个问题。

提前致谢。

【问题讨论】:

  • 在解码图像时减少样本大小。
  • 我会试试兄弟!谢谢
  • 我试过这个。我不能得到

标签: android android-imageview scale android-image aspect-ratio


【解决方案1】:

您可以尝试在 XML 中使用:

android:layout_width="match_parent"
android:layout_height="120dp"
android:scaleType="fitXY"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-25
    • 1970-01-01
    • 2012-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-20
    相关资源
    最近更新 更多