如何获得图像的缩放功能? [英] How can I get zoom functionality for images?

查看:29
本文介绍了如何获得图像的缩放功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种通用的方式来显示大图像并使用户能够放大、缩小和平移图像?

Is there a common way to show a big image and enable the user to zoom in and out and pan the image?

直到现在我找到了两种方法:

Until now I found two ways:

  1. 覆盖ImageView,对于这样一个常见问题来说,这似乎有点太多了.
  2. 使用网络视图,但对整体布局等的控制较少.

推荐答案

我使用了一个 WebView 并通过

I used a WebView and loaded the image from the memory via

webview.loadUrl("file://...")

WebView 处理所有平移缩放和滚动.如果您使用 wrap_content,则 webview 不会比图像更大,并且不会显示白色区域.WebView 是更好的 ImageView ;)

The WebView handles all the panning zooming and scrolling. If you use wrap_content the webview won't be bigger then the image and no white areas are shown. The WebView is the better ImageView ;)

这篇关于如何获得图像的缩放功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆