How to choose a word in an Android web browser?

I want to implement this function: when a user delays a word in webview, I can force the word to do something, I searched and found that: 1. android 2.3+ webview sdk really provide this function, which with a long press selects the word and calls the cursor choice of beginning and end. but under 2.3 it only provides the emulateshift function for selecting words and pasting to the clipboard, which is very ugly.

  • can anyone ever get the cursor by clicking the text box of the web view? I cannot find any methods like getSelectionStart (() in WebView, does this mean that there is no way to get the current cursor?

  • I know that even in 2.3, when the user presses for a long time, the android changes the webview to the temporary WebTextView mode, which allows the user to choose, but this is a private class, I'm trying to recreate a class like this, but it is very complicated and not a way to do something .

Does anyone successfully implement this? thanks.

+4
source share
1 answer

This, unfortunately, is almost impossible. This is a feature built deep into the system, and you must first have a built-in phone, and then mess with the rum itself.

0
source

Source: https://habr.com/ru/post/1379951/


All Articles