JAPS
JAPS

Reputation: 250

WebView shows transparent color while navigating back to Webview from next screen on ICS (Android 4)

In Android 4, CSS is ignored while navigating back to Webview from next Screen. For first time this works fine.

This behavior is only for Transparent color. Other color works fine.

WebView webView = new WebView(activity);
webView.getSettings().setJavaScriptEnabled(true);

webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL) ;
/**
 * Default color of webview must be transparent
 */
webView.setBackgroundColor(Color.TRANSPARENT);

Upvotes: 1

Views: 421

Answers (2)

JAPS
JAPS

Reputation: 250

After many tries found it was device issue!!.. :(

Upvotes: 0

DShah
DShah

Reputation: 9866

There are multiple suggestion for you as I am not an android guy :) ....

1. Hope this could help you :

mWebView.setBackgroundColor(0x00000000);

Found at : Android WebView style background-color:transparent ignored on android 2.2

2. Also try setting Alpha property to 1.

3. This must solve your problem. Try setting setBackgroundResource(int) - A drawable to use as the background. Found Link : http://developer.android.com/reference/android/webkit/WebView.html

4. Finally If above answers doesnt help then I think below link could help you. But this could be a bug in Android 4.

See the following link : http://www.iriphon.com/2011/04/27/the-android-transparent-webview-bug/

http://code.google.com/p/android/issues/detail?id=19510

Upvotes: 1

Related Questions