Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 防止在Android WebView上双击_Java_Android_Webview - Fatal编程技术网

Java 防止在Android WebView上双击

Java 防止在Android WebView上双击,java,android,webview,Java,Android,Webview,我有一个全屏网络视图,我想; 如果我的用户双击屏幕,请防止再次点击 我是非常非常新的安卓系统,请非常清楚。我粘贴了我的代码 MainActivity.java public class MainActivity extends Activity { private WebView mWebView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

我有一个全屏网络视图,我想; 如果我的用户双击屏幕,请防止再次点击

我是非常非常新的安卓系统,请非常清楚。我粘贴了我的代码

MainActivity.java

public class MainActivity extends Activity {

    private WebView mWebView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mWebView = (WebView) findViewById(R.id.activity_main_webview);

        // Force links and redirects to open in the WebView instead of in a browser
        mWebView.setWebViewClient(new WebViewClient());

        // Enable Javascript
        WebSettings webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);

        // REMOTE RESOURCE
         mWebView.loadUrl("https://www.example.com");
        mWebView.setWebViewClient(new MyWebViewClient());

    }

    // Prevent the back-button from closing the app
    @Override
    public void onBackPressed() {
        if(mWebView.canGoBack()) {
            mWebView.goBack();
        } else {
            super.onBackPressed();
        }
    }

}
MyWebViewClient.java

public class MyWebViewClient extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (Uri.parse(url).getHost().endsWith("www.example.com")) {
            return false;
        }

        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        view.getContext().startActivity(intent);
        return true;
    }
}

检查。我的请求和缩放没有任何意义。我不在乎变焦。已经,在我的网页上,当你双击它不会缩放。我想防止第二次窃听。那是it@Meltem,我不想提供半个答案,因为我无法提供完整答案。。。所以我希望其他人可以编写一些代码来实现这一点,但是如果您想防止多次单击,一个简单的方法是使用ClickListener暂停单击,如本文所示:在本例中,您的视图不是按钮,而是您的WebView