Android的:如何使用的WebView内容互动? [英] Android: How to interact with the contents of a WebView?

查看:141
本文介绍了Android的:如何使用的WebView内容互动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法以编程方式使用的WebView内容

Is there a way to programmatically interact with the contents of a WebView?

例如,怎么可能我的应用程序:

For example, how could my app:


  1. 响应于事件(例如,按钮的网页上点击)

  1. respond to an event (such as button clicked on a web page)

在所有的输入迭代在页面元素和检索的内容?

iterate through all the INPUT elements in a page and retrieve their contents?

查找与类均 DIV 元素状态并改变它们的内容?

Find all DIV elements with the class status and change their content?

谢谢!

推荐答案

您可以使用JavaScript,使回调到Java进行任何的Javascript可以检测到。

You can use Javascript to make a callback to Java for anything that Javascript can detect.

您可以看到一个演示调用JS到Java这里:<一href=\"http://stackoverflow.com/questions/4325639/android-calling-javascript-functions-in-webview\">Android调用的WebView的JavaScript函数

You can see a demo call JS to Java here: Android Calling JavaScript functions in WebView

这篇关于Android的:如何使用的WebView内容互动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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