Showing posts with label WebView. Show all posts
Showing posts with label WebView. Show all posts

Friday, April 13, 2012

Android: How to refresh on transparent background webview?

If you set Webview's background to be transparent, then whenever you load a new page, contents will overlap.

To solve this issue:


       webView.clearView();
       webView.loadUrl(url);

Clear view before you load something else.

Thursday, April 12, 2012

Android Webview with transparent background

Yes, it is possible!

           webView.setBackgroundColor(0x00FFFFFF);

However, if in your AndroidManifest.xml contains:

             android:hardwareAccelerated="true"
webView's background, for some reason, does not change to transparency.
(It took me while to figure this out!)

This is how to disable hardware acceleration on the view that contains webview:

             view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);