2012-08-14 66 views

回答

0

馬克佔位在HTML - %NAME%
話,我會加載我的HTML:

String template = Utils.inputStreamToString(assets.open("html/template.html")); 

然後我會用我想要的所有動態部分替換:

String data = template.replaceAll("%NAME%", "Alice McGee"); 

然後我會把它傳遞給我的webView!

WebView webView = new WebView(this); 
webView.loadDataWithBaseURL("file:///android_asset/html/", data, "text/html", "utf-8", null);