public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView wv = findViewById(R.id.wv);
StringBuffer sb = new StringBuffer();
//添加html
sb.append("<html><head><meta http-equiv='content-type' content='text/html; charset=utf-8'>");
sb.append("<meta charset='utf-8' content='1'></head><body style='color: black'><p></p>");
//< meta http-equiv="refresh"content="time" url="url" >
//添加文件的內(nèi)容
// sb.append("<h5>一.在線支付</h5><p>1.支付寶:支付寶即時到賬毅桃,方便快捷。</p ><p>2.網(wǎng)上銀行:通過網(wǎng)上銀行准夷,用戶可以享受到方便钥飞、快捷、高效和可靠的全方位服務(wù)衫嵌。</p >");
sb.append("</div>\n" +
" <p><span style=\"font-family: '宋體'; font-size: 10.5pt; mso-spacerun: 'yes'\"><o:p></o:p></span><span style=\"font-family: '宋體'; color: rgb(39,39,39); font-size: 10.5pt; mso-spacerun: 'yes'\"><o:p> </o:p></span><span style=\"font-family: '宋體'; color: rgb(39,39,39); font-size: 10.5pt; mso-spacerun: 'yes'\"><o:p> </o:p></span></p >\n" +
"<p><strong>1.正品承諾:</strong>動品網(wǎng)出售的大部分商品已獲得品牌商或總代授權(quán)代承,進(jìn)貨渠道正規(guī),所出售的產(chǎn)品均為正品行貨渐扮,承諾假一罰二论悴。</p >\n" +
"<p> <strong><br>\n" +
"2.平民價格:</strong>動品網(wǎng)在產(chǎn)品定價上以讓利顧客為主,更為合理的價格就能讓顧客享受到專業(yè)體育器材的品質(zhì)墓律;再加上網(wǎng)站定期會推出 廠家讓利活動膀估,所以不再議價。</p >\n" +
"<p><br>\n" +
"<strong>3.產(chǎn)品色差:</strong>所有產(chǎn)品均為實物拍攝耻讽,我們的照片盡可能的與實物顏色保持一致察纯,貨品圖片顏色大小因拍攝或計算機(jī)屏幕設(shè)定產(chǎn)生差異會 略有不同,以實際貨品顏色大小為準(zhǔn)针肥。</p >\n" +
"<p> </p >\n" +
"<p><strong>4.收貨提醒:</strong>動品網(wǎng)使用第三方快遞公司發(fā)貨饼记。您在收到產(chǎn)品包裹時務(wù)必當(dāng)著第三方快遞送貨員的面拆包驗貨,確保貨品完好慰枕。如果發(fā)現(xiàn)貨品壓損具则,可以直接拒收,然后聯(lián)系客服中心(<span style=\"color: rgb(64, 64, 64); font-family: arial; font-size: 15px; line-height: 22px; text-align: center;\">010-64663105或者010-56245509</span>)為您重新?lián)Q發(fā)您訂購的產(chǎn)品具帮。如沒有進(jìn)行檢查貨品博肋,事后貨品如損壞,動品網(wǎng)將無法賠付蜂厅。<br>\n" +
" </p >\n" +
"<p><strong>5.關(guān)于缺貨:</strong>動品網(wǎng)所上架的商品在銷售過程中可能出現(xiàn)短期缺貨的情況匪凡,而沒有及時下架,造成您的訂單中產(chǎn)品缺貨的掘猿,動品網(wǎng)會及時告知病游,您可以根據(jù)自己的情況進(jìn)行退款,取消訂單或者換貨稠通。</p >\n" +
"<p> <br>\n" +
"<strong>6.訂單取消:</strong>所有訂單在客服確認(rèn)后三天沒有付款的訂單系統(tǒng)將會自動取消衬衬。在使用動品網(wǎng)券下單后轻绞,取消訂單將導(dǎo)致動品網(wǎng)券失效,則無法返還佣耐。</p >\n" +
"<p> </p >\n" +
"<p> </p > </div>");
//加載本地文件
// sb.append("<img src='file:///"+AContext.getFileUtil().getDownloadsPath()+"'>");
sb.append("</body></html>");
// webView.loadData(data, mimeType, encoding);
//設(shè)置字符編碼,避免亂碼
wv.getSettings().setDefaultTextEncodingName("utf-8");
wv.loadDataWithBaseURL(null, sb.toString(), "text/html", "utf-8", null);
}
}
效果如下:
image.png