Android WebView 样式加载异常的问题

问题描述

在使用WebView加载html时,遇到了样式加载不出来的问题,如图所示
Android WebView 样式加载异常的问题_第1张图片

报错如下

W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities: Unsupported mime video/x-ms-wmv
W/VideoCapabilities: Unsupported mime video/divx
W/VideoCapabilities: Unsupported mime video/divx311
W/VideoCapabilities: Unsupported mime video/divx4
W/AudioCapabilities: Unsupported mime audio/dsd
W/AudioCapabilities: Unsupported mime audio/x-ape
W/AudioCapabilities: Unsupported mime audio/32KADPCM
W/AudioCapabilities: Unsupported mime audio/dts
W/VideoCapabilities: Unsupported mime video/mp4v-esdp
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es

解决

    //css样式,隐藏header
    private static final String HIDE_HEADER_STYLE = "";

    //css style tag,需要格式化
    private static final String NEEDED_FORMAT_CSS_TAG
            = "";

    // js script tag,需要格式化
    private static final String NEEDED_FORMAT_JS_TAG = "";

    public static final String MIME_TYPE = "text/html; charset=utf-8";
    public static final String ENCODING = "utf-8";

在配置css 属性和js属性的时候s被替换成了SectionsContent,不知道是什么原因,总之遇到样式加载错误的时候,应该从以下几个方面解决:
1.检查css和js属性配置是否正确
2.检查接口中js和css json数据是否为空

你可能感兴趣的:(Android WebView 样式加载异常的问题)