Android WebView flickers after call clearView ()

I am using android.webkit.WebView to display some HTML formatted information to the user. Whenever I "page" in my application, I reuse all the graphics on the screen and just fill them with other content. The WebView will by default grow in size to fit the content, but will not shrink if the content shrinks.

To fix this, I call webView.clearView()

to clear the view and then webView.loadDataWithBaseURL(null, html, "text/html", "utf-8", null)

to reload it with data. It works, but creates very strange behavior when the view starts flickering constantly. The shimmery area appears to be the same as what would be empty after filling it with less content.

I can't describe it better with words, so I created a short video to illustrate the problem: http://www.youtube.com/watch?v=yL7tQpRSFe0

The WebView is a yellow border at the bottom of the screen.

Am I doing something wrong or is this a bug? If this is an Android bug, is there a better way to resize the view to get around this issue?

+3


source to share





All Articles