0

i have a custom webview on which user can select text, i want to hide the "TEXT SELECTION HANDLES" when user click on some button at the bottom , i want the text to be selected but want to hide the handles, as you can see below :enter image description here

josh
  • 79
  • 12

2 Answers2

1
// call hideTextSelection() from your onCreate()
 function hideTextSelection(){    
 //SOLUTION 1->   vibration caused by the long click not works here
   webView.setHapticFeedbackEnabled(false);   

   //Solution 2: 
   /*webView.setOnLongClickListener(new OnLongClickListener() {
     @Override
     public boolean onLongClick(View v) {
       return true;
     }
   });
   webView.setLongClickable(false);*/
}


// whenever you wants to select the data ie. after onClicking the button 'from the bottom of your UI', make it to select as below
yourBottomButton.setOnClickListener(new OnClickListener() {
 @Override
 public boolean onClick(View v) {
  webView.setHapticFeedbackEnabled(true);
 }

});

Arwy Shelke
  • 333
  • 1
  • 2
  • 12
  • but this is not allowing me to select the text – josh May 08 '19 at 03:52
  • can you refer to this question : this is the issue i'm facing : https://stackoverflow.com/questions/56033407/hide-text-selection-handles-on-out-of-focus-android-webview – josh May 08 '19 at 08:43
0

Try this

mWebView.setOnLongClickListener(new OnLongClickListener() {
@Override
    public boolean onLongClick(View v) {
        return true;
    }
});
mWebView.setLongClickable(false);
Dinesh Shingadiya
  • 988
  • 1
  • 8
  • 23