使用自定义颜色突出显示Webview中的搜索文本 [英] Use custom color to highlight searched text in webview

查看:82
本文介绍了使用自定义颜色突出显示Webview中的搜索文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大量搜索有关如何完成此操作的文档后,我最终将其发布在SO上.

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

当前,在我的应用中,我已经实现了搜索功能,可以在webview中搜索文本.我正在使用内置的Webview方法来搜索并突出显示WebView中用户搜索的文本中的所有文本条目.

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.

推荐答案

这是否为您解决了问题: http://danbarnett.net/how-to-hide-android-webview-highlight-border-or-change-its-color-142.html

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

从听起来来看,您实际上不能更改默认值,但可以解决它,也可以使用jquery和一些CSS覆盖它.

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

还有更多有趣的Google搜索结果: http://www.icab .de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/

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

还有一个很好的答案的溢出问题: Android webview:突出显示页面中的特定单词使用javascript?

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

这篇关于使用自定义颜色突出显示Webview中的搜索文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆