1

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);
Cœur
  • 37,241
  • 25
  • 195
  • 267
JAPS
  • 250
  • 4
  • 15

2 Answers2

1

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

Community
  • 1
  • 1
DShah
  • 9,768
  • 11
  • 71
  • 127
  • Note that on ICS(Android 4.0.3), in addition to above comments; I had to disable "Settings -> Developer Options -> Force GPU Rendering" to get transparency to work with API level 10. – Aki Aug 28 '12 at 22:19
0

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

JAPS
  • 250
  • 4
  • 15