Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android HTML占位符_Android - Fatal编程技术网

Android HTML占位符

Android HTML占位符,android,Android,如何将动态字符串传递给HTML文档以替换不同的占位符 即HTML占位符%title%被标题的动态字符串替换在HTML中标记占位符- %NAME% 然后我将加载我的HTML: String template = Utils.inputStreamToString(assets.open("html/template.html")); 然后我会用我想要的替换所有动力学部件,如下所示: String data = template.replaceAll("%NAME%", "Alice McGee"

如何将动态字符串传递给HTML文档以替换不同的占位符


即HTML占位符%title%被标题的动态字符串替换

在HTML中标记占位符-
%NAME%

然后我将加载我的HTML:

String template = Utils.inputStreamToString(assets.open("html/template.html"));
然后我会用我想要的替换所有动力学部件,如下所示:

String data = template.replaceAll("%NAME%", "Alice McGee");
然后我会把它传给我的网络视图

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