保存的WebView Android SDK中内的图像 [英] Save images inside webview Android SDK
问题描述
林制作一个简单的应用程序的一些朋友在那里的Android手机,显示我的网站上的图像使用。 IM使用web视图显示在应用程序中的网站。我希望用户,才能够保存的实际图像。或者通过按住图像或实际点击一个按钮。一直对谷歌文档东张西望ANDS不能似乎找到这样的东西。
Im making a simple app for some friends to use on there android phone that shows my website with images. Im using a webview to show the website inside the app. I want the users, to be able to save the actual image. Either by Hold down on the image or actually clicking a button. Been looking around on googles docs ands cant seem to find anything for this.
推荐答案
我还没有实际使用此发挥各地还没有,但是从文件看来你至少有两个(非德precated)选项:
I haven't actually played around with this yet, but from the docs it appears you have at least two (non-deprecated) options:
根据文档,你可以使用第一个选项,以测试 IMAGE_TYPE
的结果,和URL的图像提供,以及:
According to the documentation you can use the first option to test for IMAGE_TYPE
as result, and a url to the image is provided as well:
如果找到了HTML :: img标签,该HitTestResult类型设置为
IMAGE_TYPE和URL设置中的额外字段。
If a HTML::img tag is found, the HitTestResult type is set to IMAGE_TYPE and the url is set in the "extra" field.
第二个选项会给你一个类似的结果:
The second option will give you a similar result:
请求图像的URL最后由用户触摸。味精会
发送到其目标以字符串重新presenting URL作为它的对象。
Request the url of the image last touched by the user. msg will be sent to its target with a String representing the url as its object.
不知道如果这些选项都以长按太虽然兼容。
Not sure if these options are compatible with a 'long click' too though.
另外,你怎么心里有链接点击一个按钮到一个特定的形象?根据您的这个解决方案,您还可以简单地使用捕获所有加载图片资源<一个href=\"http://developer.android.com/reference/android/webkit/WebViewClient.html#onLoadResource%28android.webkit.WebView,%20java.lang.String%29\"相对=nofollow> onLoadResource(的WebView视图,字符串URL)
,建立图像引用的列表,并下载按钮,点击是指太之一。
Alternatively, how did you have in mind to link clicking a button to a specific image? Depending on your solution for this, you may also be able to simply capture all loaded image resources using onLoadResource(WebView view, String url)
, build a list of image references and download the one that button click refers too.
这篇关于保存的WebView Android SDK中内的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!