When displaying a WebView
in full screen (fill_parent
both width and height) in Honeycomb, the HTML flickers an instant when loaded in landscape orientation.
Given this code, you should only see the yellow background (WebView
color) or the blue background (html body color). But when switching to landscape, you can see the screen partially filled in blue, and behind yellow.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView webView = (WebView) findViewById(R.id.webview);
webView.setBackgroundColor(Color.YELLOW);
webView.loadData("<html><body style='background-color:#DDF'><p>Hello world!!!</p></body></html>", "text/html", "UTF-8");
}
It's like the HTML was rendered before knowing the container size, and then it gets resized.
This can be reproduced in Android Honeycomb in landscape orientation, both in the emulator and a device.
Any ideas?
Try disabling hardware acceleration for that activity in the manifest
<activity android:name="com.sample.activity"
android:hardwareAccelerated="false"/>
I realize this post of yours is old but I figure input might still be useful. I don't have an actually honeycomb tablet to test the change of orientation but this should work regardless.
I was extremely perplexed by this, but then I noticed the problem. Simply change style from "background-color" to just "color":
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With