Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I remove Android default link styling in webview

When you click a link in the Android browser, the target link area gets highlighted with an orange box by default. A longpress then opens up the context menu for link handling (copy, paste, new window, etc). Is there a way to disable either / both of these in webview? I'm using the highlight code in scriptaculous and the default android link styling is being laid over top of the effect.

like image 619
binaryorganic Avatar asked Jul 31 '10 03:07

binaryorganic


People also ask

What is the use of WebView in Android?

The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page.

How do you override a WebView?

If you want to override certain methods, you have to create a custom WebView class which extends WebView . Also, when you are inflating the WebView , make sure you are casting it to the correct type which is CustomWebView . CustomWebView webView = (CustomWebView) findViewById(R. id.

How do I open a link in WebView?

Within the shouldOverrideUrlLoading() method simply get the URL from the request and pass into the Intent. See the full example.


2 Answers

This might be useful: How to Hide Android WebView Highlight Border

The answer being: add this CSS * { -webkit-tap-highlight-color: rgba(0, 0, 0, 0); }.

Hopefully it is.

like image 199
I82Much Avatar answered Oct 11 '22 05:10

I82Much


The suggested solution sets the color as transparent black:

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

Simply specifying the color as transparent should work:

* {
  -webkit-tap-highlight-color: transparent;
}
like image 36
Beau Smith Avatar answered Oct 11 '22 03:10

Beau Smith