用webview加载url出现空白页,测试后把百度,Github之类的url传进去都没问题,后来发现是因为布局的原因,因为webview对不同的网站兼容性没有那么强,特别是现在出现的各种前端布局,没法一一适应,在写webview布局的时候这样写:

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <WebView
            android:
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/>

    </LinearLayout>


相关文章:

  • 2021-08-15
  • 2021-05-24
  • 2021-09-06
  • 2022-12-23
  • 2021-09-21
  • 2022-12-23
  • 2021-06-23
  • 2021-05-24
猜你喜欢
  • 2022-12-23
  • 2021-05-22
  • 2021-09-18
  • 2021-11-25
  • 2022-12-23
  • 2021-09-23
  • 2021-10-29
相关资源
相似解决方案