Android 2.2 webview search problem

后端 未结 2 1862
遥遥无期
遥遥无期 2020-12-06 12:04

I have a webview in my activity. Now when I use WebView.findAll() method to search text in webview it is not highlighting the matching words.

It works f

2条回答
  •  臣服心动
    2020-12-06 12:29

    There is an issue in Android issue tracker about this: http://code.google.com/p/android/issues/detail?id=9018

    I placed this code right after WebView.findAll(), and it made highlighting working:

    try
    {
        Method m = WebView.class.getMethod("setFindIsUp", Boolean.TYPE);
        m.invoke(webView, true);
    }
    catch (Throwable ignored){}
    

提交回复
热议问题