BTAndroidWebViewSelection icon indicating copy to clipboard operation
BTAndroidWebViewSelection copied to clipboard

how can I set the selection color? how can I change the color?

Open garyliu opened this issue 11 years ago • 2 comments

garyliu avatar May 28 '13 10:05 garyliu

hi..

You can do that through Javascript. I did the same way and its working quiet fine. Something like this:

JavaScript function: android.highlight.changeSelectionColor = function (colorCode) {

window.TextSelection.jsLog("JS: changeSelectionColor --> "+colorCode);
$('#selectionColor').text("::selection {background-color: "+colorCode+";}");

};

in HTML, in head TAG something like this: ""

Now whenever, you wanna change the color, call the Javascript function through the webview's method:

webview.loadUrl("javascript:android.highlight.changeSelectionColor('#ffff7b')");

See if this works for you.

Neernay avatar Jun 06 '13 10:06 Neernay

Thanks

garyliu avatar Jan 15 '14 06:01 garyliu