DEV Community

RajuPedda
RajuPedda

Posted on

In Ionic Capacitor app, How to disable long click on WebView text selection in android

I have a hybrid app made with Svelte + capacitor. In the app we are loading digital book and we are showing custom context/tooltip menu on text selection. It is working fine on Web & Desktop apps but not on Android. On Android it is showing android default menu (copy/ paste etc). We need to disable default android text selection menu.

Tried below code, but it's not working.

mWebView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
return true;
}
});
mWebView.setLongClickable(false);

Top comments (0)