webView 不能复制解决方案

开发中遇到部分机型--主要是系统低于4.0,如果调用了WebView.setWebChromeClient的方法,则没办法长按复制文字

查了一下是系统的一个bug  https://bugzilla.wikimedia.org/show_bug.cgi?id=31484

解决方案是 覆写隐藏方法 onSelectionStart 

    private class InnerWebChromeClient extends WebChromeClient{
        public void onSelectionStart(WebView view) {
            // By default we cancel the selection again, thus disabling
            // text selection unless the chrome client supports it.
            // view.notifySelectDialogDismissed();
        }
    }

问题解决

当然,有些情况的没法复制不是因为setWebChromeClient 这个方法调用影响的,比如说html中的属性什么导致的就没办法了

原文地址:https://www.cnblogs.com/boliu/p/3303528.html