Devangi Desai
Devangi Desai

Reputation: 1383

Android webview change highlight color of the link

I need to change the default selection color of the link in Android webview. Going through the few questions in the stack overflow didn't help me . Below question answer how to remove it. I want to just change the color from orange to e.g. red. Android browser GREEN border on click

Can some one help me out ?

Upvotes: 4

Views: 3336

Answers (2)

kaleazy
kaleazy

Reputation: 6232

If you don't mind getting jQuery involved (I never do), first add this:

* {
    -webkit-tap-highlight-color: rgba(0,0,0,0);  
}

Then use the touchstart or touchend commands like this:

$("li").bind('touchstart', function(){
    $(this).css("border","1px solid green");
    setTimeout("$('li').css('border','none')",1500);
});

Upvotes: 2

Christine
Christine

Reputation: 5575

You can't change it in WebView. You can however read the data as a string, replace all a tags by (lt)font color="#0000FF"(gt)(lt)a (and change the /a tags accordingly) and then load the string in WebView with webView.loadData(String string ..).

Upvotes: 1

Related Questions