Search code examples
androidcordovawebviewandroid-4.0-ice-cream-sandwichandroid-2.3-gingerbread

Change background color of app visible during resizing webView due to device orientation change


when cordova webView is resized due to orieantation change, there is a moment, in which webView do not cover entire screen area. That is understandable, also user expecting that. But my application have black background, and background of app, which is not covered by webView in the moment have white color and this looks ugly.

There are photo of this problem. It's end of rotation animation, moment before white rectangle disappear. (It is truly moment [a few hundred of miliseconds], so I had to take a photo :-) )
http://oi57.tinypic.com/15f4u4n.jpg

What I tried:

  • Set BackroundColor preference in config.xml to 0xff000000
  • Set android:theme of application (and activity) to @android:style/Theme.Black.NoTitleBar
  • setBackgroundColor(Color.BLACK) in onCreate method of activity after init to appView, super.root and getWindow().getDecorView()
  • Black background (of html and body) is already set in css

I really don't know how to get rid of this white shine. :-)

Note: This issue occurs on Android 2.3 and 4.0. Android 4.1 and up does not have this problem.


Solution

  • I did error somewhere, because appView.setBackgroundColor(Color.BLACK) (appView is Cordova webView) works. But that, the BackgroundColor doesn't do this for you, is bug in Cordova and is now fixed in the next Cordova version (3.6). CB-7159