Issue
A Webview will display links in the content HTML as having blue underlines. So if you have something in the HTML like
<a href="...">blah blah</a>
... it is clearly visible as a link.
The Webview also allows you to click on phone numbers and addresses (even if those are just text in the HTML, not links) to launch the Dialer or Maps.
How can one get Webview to display those (Linkify, probably) links with underlines etc? It's easy enough in a TextView since one can get the spans from a TextView and style them, but Webview doesn't expose any way to retrieve that data... at least not that I can see looking through the docs.
Solution
Given this:
it still doesn't seem to be a way to do this from Java directly. One thing that might work is to write some JavaScript code and run it after page is loaded, e.g. as given here:
Here's an example of a similar thing:
where the idea is to disable links. You may be able to use a similar approach to add some CSS, including underlining. A couple of other SOqs / links that might help:
- Android: Injecting Javascript into a Webview outside the onPageFinished Event
- Android: Injecting Javascript into a Webview outside the onPageFinished Event
- http://iphoneincubator.com/blog/windows-views/how-to-inject-javascript-functions-into-a-uiwebview
- Injecting Javascript into a Webview outside the onPageFinished Event (Using DatePicker to set a date on an input of a WebView)
Hope this helps.
Answered By - icyrock.com
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.