Web选项卡未在选项卡上正确加载

时间:2016-10-07 11:49:26

标签: android html webview

我有这个网页视图,我从网络服务加载它,我安装应用程序的每个手机(所有这些都是kitkat及以上)它看起来很棒和格式化(有大胆的标题)。但是我把这个应用程序安装在一个带有冰淇淋三明治软件的旧平板电脑上,并且文本不像其他手机那样没有加载粗体标签。你能帮我吗 这是我的代码:

 if (MyApplication.lang.equals("en")) {
        userGuide.loadDataWithBaseURL("file:///android_asset/", "<html><head>\n" +
                "<meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;\"/>" +
                "<style type=\"text/css\">\n" +
                "@font-face {\n" +
                "    font-family: MyFont;\n" +
                "    src: url(\"file:///android_asset/OpenSans-Regular.ttf\")\n" +
                "}\n" +
                "body {\n" +
                "    font-family: MyFont;\n" +
                "    font-size: 15;\n" +
                "    text-align: justify;\n" +
                "}\n" +
                "</style><body>" + MyApplication.contact.getDataEn() + "</body></html>", "text/html", "UTF-8", "");

    } else {
        userGuide.loadDataWithBaseURL("file:///android_asset/", "<html><head>\n" +
                "<meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;\"/>" +
                "<style type=\"text/css\">\n" +
                "@font-face {\n" +
                "    font-family: MyFont;\n" +
                "    src: url(\"file:///android_asset/GE_Dinar_Two_Medium.otf\")\n" +
                "}\n" +
                "body {\n" +
                "    font-family: MyFont;\n" +
                "    font-size: 30;\n" +
                "    text-align: justify;\n" +
                "}\n" +
                "</style><body>" + MyApplication.contact.getDataAr() + "</body></html>", "text/html", "UTF-8", "");
    }
    userGuide.setBackgroundColor(0);

on nexus

on tablet

1 个答案:

答案 0 :(得分:0)

根据您的评论,complete change that WebView had in KitKat,我建议您使用Chrome开发者工具查看问题所在。步骤进行:

  1. 使用USB连接线将设备连接到计算机
  2. 确保设置中的developer options are enabled
  3. 打开Goog​​le Chrome并导航至chrome:// inspect
  4. 从那里,您将能够选择WebView并远程检查,进行调整等。
  5. 希望这有帮助。