eddie eddie - 1 month ago 20
Android Question

Android - If WebView visible an extra, buggus, View is also is created

I'm having a strange bug: a new box appears in the screen (even outside the bounds of the app) when a WebView is visible in my RecyclerView. This box has the same dimensions of the WebView and it appears at the bottom-left corner (A grey box on the bottom-left of the image)

I will describe the context of the error, as I cannot identify the source of the issue.


  1. Happens in some devices only. Example: Android 6.0.1 w/ Nexus 7. And doesn't happen in the emulator with the same version.

  2. The View/Box is not listed in the hierarchy of views of "Android Device Monitor" "View hierarchy"

  3. Only happens with WebViews are visible in the RecyclerView. No other view has this issue.

  4. The box always appears on the bottom-left corner of the screen (in the image you can see that it is over the on-screen back-button)

  5. The box is not always visible. Most of the times it appears, some times it disappears after scrolling a bit (with the WebView still visible).

  6. I've disabled recycling for this cell type.

  7. The WebView is created in a XML. And the data is loaded with:

    public static void textHtml(ChatViewHolder cvh, Message message) {
    cvh.webView.loadData(message.content, "text/html", "UTF-8");
    cvh.webView.setOnTouchListener((v, event) -> true);
    }



Any help fixing the issue or insights on understanding why this happens would be greatly appreciated.

If needed, please ask for more information.

Thanks!



enter image description here

Another screenshot of the problem. (Only light green boxes where added after the screenshot was taken)

There is an unintentional white box at the bottom of the screen.

enter image description here

Answer

It looks like a Android System WebView APK 53.0.x. bug. Updating to version Android System WebView 54.0.x solved the issue.

Thanks @rds I started looking into this.