【发布时间】:2011-08-31 04:56:18
【问题描述】:
想象一个如下所示的 HTML 模板:
<html>
<head>
<style type="text/css">
body {
color: white;
}
</style>
</head>
<body>
The changes include:
<br/><br/>
%1$s
<br/><br/>
Would you like to update now?
</body>
</html>
我知道我可以使用webView.loadUrl("file:///android_asset/html/upgrade.html") 将内容加载到 WebView 中。但我也想在运行时替换 $1,就像我使用 String.format() 从 XML 文件加载它一样。
是否可以先将文件内容加载到字符串中,以便我可以在其上运行String.format(),然后改用webView.loadData()?
【问题讨论】: