我假设您的样式表“ style.css”已经位于资产文件夹中
使用jsoup加载网页:
doc = Jsoup.connect("http://....").get();
删除到外部样式表的链接:
// remove links to external style-sheets
doc.head().getElementsByTag("link").remove();
将链接设置为本地样式表:
// set link to local stylesheet
//
doc.head().appendElement("link").attr("rel", "stylesheet").attr("type", "text/css").attr("href", "style.css");
从jsoup-doc / web-page生成字符串:
String htmldata = doc.outerHtml();
在webview中显示网页:
WebView webview = new WebView(this);
setContentView(webview);
webview.loadDataWithBaseURL("file:///android_asset/.", htmlData, "text/html", "UTF-8", null);