I created an application that opens the contents of the html-files originally present in the project, but it’s impossible to prevent the ability to select the text displayed in WebView. How can I prevent the selection of text, and copy it?
3 answers
user-select: none can try
- But where exactly should such a method be prescribed? - Marc Severin
- figured out '<style type = "text / css"> body {-webkit-user-select: none; } .enable {-webkit-user-select: text; } </ style> ' - Mark Severin
|
Try this:
webView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { return true; } }); webView.setLongClickable(false); - something didn’t work, and the android site didn’t find OnLongClickListener documentation for WebView - Mark Severin
|
All figured out. This should be in html :
<style type="text/css"> body { -webkit-user-select: none; } .enable { -webkit-user-select: text; } </style> |