开发者

Orange rectangle around links in WebView

I have a web view that is loaded with an HTML that contains links. wh开发者_如何学运维en 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.


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


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.


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().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜