【问题标题】:how to hide Text selection handle from webview : android如何从 webview 隐藏文本选择句柄:android
【发布时间】:2019-09-25 01:40:08
【问题描述】:

我有一个自定义 web 视图,用户可以在其上选择文本,当用户单击底部的某个按钮时,我想隐藏“文本选择句柄”,我希望选择文本但想隐藏句柄,如你可以在下面看到:

【问题讨论】:

    标签: android layout webview textselection


    【解决方案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);
     }
    

    });

    【讨论】:

    【解决方案2】:

    试试这个

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

    【讨论】:

      猜你喜欢
      • 2019-09-25
      • 2021-04-20
      • 1970-01-01
      • 2014-05-17
      • 1970-01-01
      • 2013-12-13
      • 1970-01-01
      • 2011-08-28
      相关资源
      最近更新 更多