R__
R__

Reputation: 21

Improve webview performance - android

I'm developing an application that use a webview which loads an Html & javascript files.

but the performance was too bad when its display the content!

I've tried many solutions like:

        webView.getSettings().setRenderPriority(RenderPriority.HIGH); 
    webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); 
    webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);

but it's still remain the same.

Any advice or tips to enhance the performance?

Upvotes: 2

Views: 2763

Answers (2)

Erex
Erex

Reputation: 1673

If there's only some few components of your webview that is slow or laggy, try adding this to the elements css:

transform: translate3d(0,0,0);
-webkit-transform: translate3d(0,0,0);

This has been the only speedhack that really had a effect on my webview. But be careful not to overuse it! (you can read more about the hack in this article.)

Upvotes: 2

wael
wael

Reputation: 454

try adding

webView.getSettings().setJavaScriptEnabled(true);

Upvotes: 0

Related Questions