2013-09-12

I have a Javascript-based component to my application, I open it with a FrameLayout containing a WebView. This component must always be oriented very specifically, so I rotate it with WebView.rotate() depending on the device orientation. The WebView needs to be hardware accelerated.

Now this is where the problem shows up. After calling rotate() with any value that isn't 0, (i.e. actually rotating the WebView) causes the WebView to vanish. I gave the WebView a red background, the WebView shows up and then when the Javascript loads it vanishes. The bottom layer is suddenly intractable, as though the WebView isn't on screen. Disabling hardware acceleration fixes this, and the view shows up and rotates properly.

It gets weirder, the application behaves like the above in an SGS2 and a Nexus 4, but works just fine (with hardware acceleration enabled) in the emulator.

Any idea on what may be causing this?

Show more