在android中单击动态Web视图的事件

时间:2015-11-04 11:49:43

标签: android webview

我在Android应用程序中使用动态Web视图。我需要为Web视图实现onclick事件。我尝试了这段代码,但我没有收到点击事件

WebSettings settings = wv.getSettings();
    settings.setJavaScriptEnabled(true);
    wv.addJavascriptInterface(new Object()
    {
        @JavascriptInterface
        public void performClick()
        {
            Toast.makeText(QuestionPaper.this, "webview click is  working", 5000).show();
            wv.setBackgroundColor(Color.RED);
        }
    }, "ok");

0 个答案:

没有答案