My application playing HTML
promotions in WebView
, Html promotions having text so if user press long click android standard dialog appear Copy/Share/Find/Web Search
, so is there any option to disable text selection dialog for webview ?
Help me on the same.
You can use the user-select property to disable text selection of an element. In web browsers, if you double-click on some text it will be selected/highlighted. This property can be used to prevent this.
1) android:longClickable="false" 2) webView. setLongClickable(false); 3) webView. setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { return true; } });
In order to enable and disable javascript code in react native application, we need to use below props in WebView component : If we set javaScriptEnabled={true} then it will Enable the JavaScript on WebView. If we set javaScriptEnabled={false} then it will Disable the JavaScript on WebView.
You need to do this way:
WebView webView = (WebView) findViewById(R.id.webView);
webView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
});
webView.setLongClickable(false);
// Below line prevent vibration on Long click
webView.setHapticFeedbackEnabled(false);
Hope this will help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With