【问题标题】:View Large image in a specified ImageView dimensions以指定的 ImageView 尺寸查看大图
【发布时间】:2015-03-09 18:51:58
【问题描述】:

我有一张尺寸为 1200x2400 的大图。我能够使用 Picasso 将其加载到图像视图中。但是我失去了图像的质量。

我要找的是:在 html 中,您可以指定<img src ="img_Src" width="400" height="500">,您可以在其中更改宽度和高度。我们可以在 android 中做类似的事情 - 将完整图像加载到特定的 ImageView(比如 parent_with x parent_height)并缩放它以便您看到其中的清晰内容吗?

【问题讨论】:

    标签: android image-processing imageview picasso


    【解决方案1】:

    库存 ImageView 不支持捏缩放。使用 this one 之类的库为您提供支持它的直接替换。

    但是,在处理这种尺寸的图像时,您可能会耗尽内存并崩溃,尤其是在许多常见的中低端手机中。

    【讨论】:

      【解决方案2】:

      您可以使用毕加索支持的调整大小功能

      Picasso.with(this)
       .load("your image url")
       .resize(100, 100)
       .into(imageView)
      

      resize(100,100) 以 dp 为单位的宽度和高度(resize(width,height) 是通用格式)

      【讨论】:

      • 调整大小实际上是缩小图像。当我放大它时,没有质量。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-23
      • 1970-01-01
      相关资源
      最近更新 更多