Black flickering on Honeycomb WebView

I’ve run into a problem when using <input type="password"> fields in a WebView on Honeycomb devices. Any time the view is scrolled, the screen flickers black and can even stay all black (except that it will draw the focused password field) once scrolling ends. I’ve seen this on all three Honeycomb tablets I’ve checked.

I can load the same HTML in the Browser app and I do not see this issue. I’ve tried changing many of the settings on the WebSettings/WebChromeClient/WebViewClient of the WebView and had no luck there. I’ve loaded the code below on a Froyo tablet and this issue did not occur, so it seems like a Honeycomb specific issue.

  • Javadoc not shown when using a local Maven repo
  • How to change size of title's text on Action Bar?
  • Android: EditText.setInputType() how to setup for email but not auto-suggest
  • How to tell Gradle to use a different AndroidManifest from the command line?
  • android splash screen sizes for ldpi,mdpi, hdpi, xhdpi displays ? - eg : 1024X768 pixels for ldpi
  • Smooth animated Collapsing Toolbar with Android Design Support Library
  • Has anyone seen this before? I’m at a loss on how to fix or workaround this issue currently.

    Here’s a short code sample that reproduces the issue. Simply focus the password field and scroll up and down. There’s a password type input field and a text type input field, just to show that the issue does not occur with the text type field. The <div> tag is there simply to make it easier to scroll around and see the issue, although the issue still occurs without the <div> tag.

    import android.os.Bundle;
    import android.webkit.WebView;
    public class PasswordFieldTest extends Activity {
        /** Called when the activity is first created. */
        public void onCreate(Bundle savedInstanceState) {
            WebView webview = new WebView(this);
            String html = "<html><body><div style=\"with: 120%; height: 200%; border: 20px dashed black;\">" +
                "Password: <input type=\"password\" name=\"passfield\"/><br/>" +
                "Text: <input type=\"text\" name=\"textfield\"/>" +
            webview.loadData(html, "text/html", "utf-8");

    Related posts:

    Android - How to tap ListView item programmatically
    Trying to play video from raw folder (VideoView)
    How to capture both front and back cameras in Galaxy S4 simultaneously?
    Unit Test Cases with JUnit +(Robolectric or Mockito or both in Android)
    On Android, make a POST request with URL Encoded Form data without using UrlEncodedFormEntity
    Retrieve IMEI number/ sim number/mobile number via mobile browser
  • How to make a edittext box in a dialog
  • Disable hamburger to back arrow animation on Toolbar
  • What is the primary usage of upstream messaging in GCM Cloud Connection Server?
  • character mapping in edittext android
  • RelativeLayout add rule “RelativeLayout.LEFT_OF” not working
  • Android: SSLException I/O error during system call, Connection timed out
  • 4 Solutions collect form web for “Black flickering on Honeycomb WebView”

    After trying everything suggested here, this finally worked for me on all the phones:



    if (android.os.Build.VERSION.SDK_INT < 16) {
    } else {
     webView.setBackgroundColor(Color.argb(1, 0, 0, 0));

    Please let me know if you find a phone this doesn’t work on.
    Works with these phones:

    • note2 (4.1.2)
    • htc one x (4.0.4)
    • galaxy s3 (4.3)
    • nexus4 (4.3)

    This is a known issue in honeycomb devices.

    However this one worked for me –


    Make sure to implement a Compatibility layer, since following method doesn’t work in SDK_INT < 11.

    webViewInstance.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    List of solutions suggested are here.

    This sounds like a android:cacheColorHint issue. Try setting it to transparent in the WebView’s attribute set.

    For me android:layer="software" in the xml layout file works fine.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.