如何选择机器人的WebView一个字? [英] how to select a word in android webview?

查看:143
本文介绍了如何选择机器人的WebView一个字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现这个功能:当用户长preSS web视图中的一个字,我能得到这个词做一些事情,我搜索和发现: 1.安卓2.3 +的的WebView SDK确实提供这种功能,当长preSS,它突出了字,并提出了起点和终点选择光标。但在2.3它只提供了emulateshift功能来选择的话,并粘贴到剪贴板,这是非常难看。

I want to implement this function: when user longpress a word in webview, I can get the word to do something, I search and found that: 1. android 2.3+'s webview sdk do provide this function which when long press, it highlights the word and brings up the start and end selection cursor. but under 2.3 it only provides the emulateshift function to select words and paste to clipboard, which is very ugly.

  1. 没有任何人能永远得到光标同时点击web视图的文本字段?我找不到像getSelectionStart(()的web视图的任何方法,岂不是没有办法获取当前光标?

  1. does anybody can ever get the cursor while click on the text field of the webview? I can't find any methods like getSelectionStart(() in WebView, does it mean that there is no way to get the current cursor?

我知道,即使是在2.3,当用户长presses,Android的改变的WebView到一个临时WebTextView模式,可以让用户选择,但它是一个私有类,我尝试重新创建一个一流的那样,但它是非常复杂的,没办法把事情做好。

I know that even on 2.3, when user long presses, android change the webview into a temporary WebTextView mode which can let the user to select, but it is a private class, I try to recreate a class like that,but it is very complicated and no way to get things done.

已经有人成功实现这一点?谢谢你。

has anybody successfully implement this? thank you.

推荐答案

这家饭店目前几乎是不可能的。它是一个功能深深地嵌入在系统中,你首先必须有一个根深蒂固的电话,然后鼓捣ROM本身。

That is unfortunately close to impossible. It is a function embedded deep in the system and you would first have to have a rooted phone and then tinker with the rom itself.

这篇关于如何选择机器人的WebView一个字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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