[英]Android JSoup use site css for extracted div class
I'm currently working on an app which displays one div class of a webpage. 我目前正在开发一个可显示网页的div类的应用。 The problem is, that this div class is (of course) not using the site's CSS anymore.
问题是,这个div类(当然)不再使用站点的CSS。 No I want to add the CSS back to the displayed div class.
否,我想将CSS添加回显示的div类。 But how can I do that?
但是我该怎么办呢?
Here is my code for displaying the "events" div: 这是我用于显示“事件” div的代码:
private class LoadData extends AsyncTask<Void,Void,Void>
{
String html=new String();
Document doc = null;
Elements ele = null;
@Override
protected Void doInBackground(Void... params) {
try {
doc = Jsoup.connect(URL).timeout(100000).get();
} catch (IOException e) {
e.printStackTrace();
}
Elements ele = doc.select("div.events");
html = ele.toString();
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
String mime = "text/html";
String encoding = "utf-8";
myWebView.loadData(html, mime, encoding);
}
}
您可以通过jsoup获得“样式”或“链接”标签,并添加到html数据中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.