android webview 部分机型 加载空白的问题

有时候,真的不能怪手机 手机太冤枉。现在遇到一个问题是,dialog中显示一个webview ,在手机上测试的可以正常打开,到智能设备上,一直空白。都要开始怀疑是web端的问题了,哈哈。之后看了一位小主的博客,才找到解决办法,再次感谢

之前写的webview布局是:

<WebView
    android:id="@+id/webview_file"
    android:layout_width="match_parent"
    android:layout_height="match_parent" /> 这样的 

修改完之后,是这样的

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linear_browse"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
   >

    <WebView
        android:id="@+id/webview_file"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_x="0.0dip"
        android:layout_y="0.0dip"
        android:layout_weight="1.0"/>


</RelativeLayout>

,其实,为什么这样写,我还没研究到,不过确实解决了我的问题,有小伙伴说添加一个

settings.setDomStorageEnabled(true); 支持H5 表示已经加过。。but 还是不行,soga 用了这个方法 搞定,下面附上原地址嗯哼 https://blog.csdn.net/ldwtill/article/details/8696499

猜你喜欢

转载自blog.csdn.net/zww986736788/article/details/88844043