WebView加载Html的图片文字,或者图文混排

版权声明:转载请注明出处 https://blog.csdn.net/dl10210950/article/details/72518782
<section class="wwei-editor"><blockquote style="padding: 10px; margin: 5px 0px 0px; white-space: normal; max-width: 100%; line-height: 25px; font-size: 14px; font-family: arial, helvetica, sans-serif; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; color: rgb(255, 255, 255); border-left-color: rgb(0, 187, 236); border-left-width: 10px; border-left-style: solid; box-shadow: rgb(153, 153, 153) 2px 2px 4px; text-shadow: rgb(34, 95, 135) 0px 1px 0px; word-wrap: break-word !important; box-sizing: border-box !important; background-color: rgb(55, 57, 57);"><span style="max-width: 100%; word-wrap: break-word !important; box-sizing: border-box !important;"><span style="max-width: 100%; font-family: 微软雅黑; font-size: 16px; word-wrap: break-word !important; box-sizing: border-box !important;">1、这里输入标题</span></span></blockquote></section><section class="wwei-editor"><h2 style="padding: 0px; margin: 8px 0px 0px; font-weight: normal; font-size: 16px; font-family: 微软雅黑; white-space: normal; height: 32px; text-align: justify; color: rgb(62, 62, 62); line-height: 18px; border-bottom-color: rgb(227, 227, 227); border-bottom-width: 1px; border-bottom-style: solid;"><span style="padding: 0px 2px 3px; color: rgb(0, 112, 192); line-height: 28px; border-bottom-color: rgb(0, 187, 236); border-bottom-width: 2px; border-bottom-style: solid; float: left; display: block;"><span style="padding: 4px 10px; border-top-left-radius: 80%; border-top-right-radius: 100%; border-bottom-right-radius: 90%; border-bottom-left-radius: 20%; color: rgb(255, 255, 255); margin-right: 8px; background-color: rgb(0, 187, 236);">序号.</span><span style="color: rgb(0, 187, 236);">标题党</span></span></h2></section><p><br/></p><section class="wwei-editor"><section style="max-width: 100%;margin: 0.8em 0px 0.5em; overflow: hidden; "><section placeholder="请输入标题" style="box-sizing: border-box !important;  height:36px;display: inline-block;color: #FFF; font-size: 16px;font-weight:bold; padding:0 10px;line-height: 36px;float: left; vertical-align: top; background-color: rgb(249, 110, 87); " class="wweibrush">请输入标题</section><section style="box-sizing: border-box !important; display: inline-block;height:36px; vertical-align: top; border-left-width: 9px; border-left-style: solid; border-left-color: rgb(249, 110, 87); border-top-width: 18px !important; border-top-style: solid !important; border-top-color: transparent !important; border-bottom-width: 18px !important; border-bottom-style: solid !important; border-bottom-color: transparent !important;"></section></section></section><p><br/></p><p><br/></p>

上面是一段Html格式的字符串名字为:pic_content用WebView加载的写法是:

        webView = (WebView) findViewById(R.id.web_view);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.loadDataWithBaseURL(null,pic_content,"text/html", "utf-8",null);
        webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);

效果如下:
这里写图片描述

猜你喜欢

转载自blog.csdn.net/dl10210950/article/details/72518782