html 滑动卡顿问题

  最近做项目有一个加载3d效果要求,本质是html ,但是在滑动的时候一直卡屏,想着应该是缓存,查找资料终于不卡了,

    WebSettings webSettings = mWebView.getSettings();
    //对离线应用的支持
    webSettings.setDomStorageEnabled(true);
    webSettings.setAppCacheMaxSize(1024*1024*10);//设置缓冲大小,10M
    String appCacheDir = this.getApplicationContext().getDir("cache", Context.MODE_PRIVATE).getPath();
    webSettings.setAppCachePath(appCacheDir);
    webSettings.setAllowFileAccess(true);
    webSettings.setAppCacheEnabled(true);
    webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
    mWebView.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) { //  重写此方法表明点击网页里面的链接还是在当前的webview里跳转,不跳到浏览器那边
            view.loadUrl(url);
            return true;
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            view.getSettings().setJavaScriptEnabled(true);
            super.onPageFinished(view, url);
            Tools.dismissWaitDialog();
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            view.getSettings().setJavaScriptEnabled(true);
            super.onPageStarted(view, url, favicon);
        }

        @Override
        public void onReceivedError(WebView view, int errorCode,
                                    String description, String failingUrl) {
            Tools.dismissWaitDialog();
            super.onReceivedError(view, errorCode, description, failingUrl);
        }

        @Override
        public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
            WebResourceResponse response = super.shouldInterceptRequest(view, url);
            return response;
        }
    });

    mWebView.loadUrl("http://www.qofo360.com/0web/oymc/index.html");
}

你可能感兴趣的:(安卓开发)