WebView加載html圖文時圖像會有適配屏幕的問題
String js = "<script type=\"text/javascript\">"+
? ? ? ?"var imgs = document.getElementsByTagName('img');" + // 找到img標簽
? ? ? "for(var i = 0; i<imgs.length; i++){" + // 逐個改變
? ? ? "imgs[i].style.width = '100%';" + // 寬度改為100%
? ? ? "imgs[i].style.height = 'auto';" +
? ? ? "}" + "</script>";
webView.loadDataWithBaseURL(ApiService.IMAGE_URL,url+js,? "text/html", "UTF-8", null)
為防止忘記儡蔓,特此記錄。