Search code examples
androidwebviewandroid-3.0-honeycombhardware-accelerationandroid-4.0-ice-cream-sandwich

WebView inside ViewPager or ScrollView - weird rendering bug on Android 3.0+


I have a ViewPager. Every page of the ViewPager is a ScrollView. The ScrollView contains a WebView and several other Views.

On Android 2.3 and older everything works fine but on 3.0+ there's a weird rendering issue:

The WebView should start right under the photo

When scrolling left / right in the ViewPager, there is also a very subtle rendering issue (which is present in Android 4.0 Gmail app too).


Solution

  • I partially solved it by calling webView.requestLayout() in ScrollView.onScrollChanged(). It is now almost ok, but when scrolling, the WebView seems slightly out of sync with other ScrollView children. Sometimes the WebView seems to scroll slightly slowly than other Views and catches up with them a moment later.