WebView有时为空

时间:2018-10-13 11:23:17

标签: android webview

WebView在0.1-0.5%的情况下为空。滚动屏幕(CoordinatorLayout)或切换到其他应用并返回后,将显示内容。

试图通过检查WebView( Bitmap.createBitmap(view.getDrawingCache()))的空屏幕截图来检测这种情况,但该警告应在出现后0.5秒钟进行,但它始终有效。但是,获得有效的屏幕快照后,它在显示屏上仍然为空。 (也尝试获取完整屏幕的屏幕快照,这也总是有效的。)

疲倦于跟踪转储布局层次结构,坐标看起来类似于出现内容时的情况。

在错误发生之前,早先使用同一WebView数百次都没有问题。先前的内容会按原样消失,但不会呈现新内容。

布局:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    app:visible_or_gone="@{data.state == ViewState.QUESTION}">

    <WebView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:html_data="@{data.renderQuestion}"/>

时间轴:

  • +0.0秒LinearLayout.visibility设置为“消失”
  • 设置了+0.1秒的WebView.html_data
  • + 0.5-2秒LinerarLayout.visibility设置为VISIBLE
  • 为诊断目的拍摄的+0.5秒屏幕截图

所有更新都是在UI线程中完成的。

发现我并不孤单,但无法从以下链接中找到解决方案: https://bugs.chromium.org/p/chromium/issues/detail?id=474167

WebView empty until I touch the component

0 个答案:

没有答案
相关问题