Abhishek Sabbarwal
Abhishek Sabbarwal

Reputation: 3808

Use custom color to highlight searched text in webview

After a lot of searching for documentation on how this can be done I am finally posting this on SO.

Currently in my app I have implemented a search feature to search text in webview. I am using the inbuilt webview methods to search and highlight all text entries, of the text searched by the user, in the webview.

I now want to change the default highlight color to my own custom color and not use the default implementation. I have been trying to look over everywhere for this but I did not see any specific way of how this can be done.

Can someone please give some hints/suggestions on how this can be done. Very thankful if you stopby and put some of your thoughts.

Upvotes: 2

Views: 3431

Answers (1)

Paul
Paul

Reputation: 276

Does this do the trick for you: http://danbarnett.net/how-to-hide-android-webview-highlight-border-or-change-its-color-142.html

From the sounds of it you can't actually change the default but you can work around it, or over-ride it using jquery and some css..

And some more Google results of interest: http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/

And an overflow question with good answer: Android webview: highlight a specific word in a page using javascript?

Upvotes: 2

Related Questions