我怎样才能获得的图像缩放功能? [英] How can I get zoom functionality for images?

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

问题描述

有一个共同的方式来显示一个大的图像,使用户可以放大和缩小和平移图像?

到现在为止,我发现有两种方式:

  1. 覆盖ImageView的,这似乎有点吃不消这样一个共同的问题。
  2. 在使用的WebView但在整体布局等的控制较少。
解决方案

我用了一个web视图,并通过

加载从存储器中的图像

  webview.loadUrl(文件:// ......)
 

web视图处理所有的平移缩放和滚动。如果您使用WRAP_CONTENT web视图不会更大然后是形象,没有白色区域显示。 web视图是更好的ImageView的;)

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. overwriting ImageView, that seems a little bit too much for such a common problem.
  2. using a webview but with less control over the overall layout etc.

解决方案

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

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

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天全站免登陆