如何在android中实现选择并突出显示文本 [英] How do i implement select and highlight text in android

查看:98
本文介绍了如何在android中实现选择并突出显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用eBook阅读器应用程序,我需要实现选择和突出显示功能,例如在Amazon-kindle,kobo,moon +阅读器等中实现的功能.

I am working on eBook reader app and I need to implement select and highlight feature like implemented in Amazon-kindle, kobo,moon+ reader etc.

我尝试使用WebView,因为我们可以在发生长时间触摸事件时在2.3及更高版本的android OS中选择文本.我没有得到window.getSelection()对象,所以我的JavaScript没有突出显示文本.

I tried with WebView as we can select text in 2.3 and later versions of android OS on long touch event. I am not getting the window.getSelection() object so my JavaScript is not highlighting the text.

这是可能的,因为其他应用程序已经实现了此功能.

This is possible, as other apps have implemented this feature.

有人知道该怎么做吗?我需要使用特殊的API吗?

Does anyone know how to do this? Is there a special API I need to use?

推荐答案

在此开源项目中看看此处

在android webview中进行选择和复制是一件很棒的工作.

It is a wonderful work for select and copy in android webview.

这篇关于如何在android中实现选择并突出显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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