oriharel
oriharel

Reputation: 10468

Orange rectangle around links in WebView

I have a web view that is loaded with an HTML that contains links. when I switch to another activity (say to another tab in a tab activity) and then switching back to it, the link is surrounded with an orange rectangle. also happens in the GoogleAdView which really makes it impossible to view.

Upvotes: 1

Views: 4095

Answers (3)

Yoel Gluschnaider
Yoel Gluschnaider

Reputation: 1814

Try webView.setFocusableInTouchMode(false) - it worked for me. Also, read this link if you want to understand what drove me to this solution.

You should take into account though that this solution will make all text input boxes in your webpage unavailable...

Found another solution, but it requires access to the html itself. You need to set the following css property: -webkit-tap-highlight-color:rgba(0,0,0,0); This will not cause the problem with the input boxes.

Upvotes: 6

Guy
Guy

Reputation: 91

Try this to prevent webview from drawing a focus rectangle when it is first focused webView.getSettings().setNeedInitialFocus(false);

Upvotes: 9

Mathias Conradt
Mathias Conradt

Reputation: 28685

It seems that the link in the WebView has the focus. Maybe you could avoid it by letting another view request the focus (anotherView.requestFocus();) in onResume() or onStart().

Upvotes: 1

Related Questions