Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable the default highlight menus in android webview?

Tags:

How to enable the default text highlights menu like: Copy/Paste/Search/Share in android webview ?

enter image description here

like image 299
Jega Avatar asked Sep 28 '11 09:09

Jega


People also ask

Which of the following is enabled by default in Android WebView?

All that WebView does, by default, is show a web page.

What is WebView DevTools?

WebView DevTools are a set of on-device tools to help debug your WebView apps. The best way to launch WebView DevTools is to download WebView Beta, Dev, or Canary. These channels contain a launcher icon which launches WebView DevTools.

How can I make WebView keep a video or audio playing in the background?

Solution. After searching a lot, I found this thread. I did something similar: Just extend WebView and override onWindowVisibilityChanged . This way, the audio continues to play if the screen is locked or another app is opened.


1 Answers

Working on Android 1.5 - 2.3 you can use emulateShiftHeld() made public since 2.2 but now is deprecated. this method put your WebView into text selection mode.

https://developer.android.com/reference/android/webkit/WebView.html#emulateShiftHeld%28%29

Unfortunately there's no copy/paste/search/share function integrated in Android, since Android 2.0 the text selection can be driven by touch but other than that, there's no other thing you can do.

like image 94
Jorgesys Avatar answered Oct 16 '22 05:10

Jorgesys