我需要使用 Assets 文件夹中的 CSS 文件加载 URL。在搜索时,我不断遇到如下代码:
webView.loadDataWithBaseURL("file:///android_asset/",
string, "text/html", "UTF-8", null);
但我不确定如何让它发挥作用。我可以这样定义第二个字符串:
string = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />"
+ string;
这似乎在引用 CSS 时有效,但我该如何提取 URL?
最佳答案
<html>
<head>
<link rel="stylesheet" type="text/css" href="styleSheetName.css" />
</head>
<body>
</body>
</html>
关于android - 如何使用 Assets 文件夹中的 CSS 文件加载 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12848588/