嘿我试图占用一个网站的特定部分,然后在我的网页视图中显示它,但问题是当我这样做时,在较小的屏幕上,这些字母得到了所有有问题的白色口音和东西,有什么方法我可以只将网站的特定div转移到我的网页视图,而不是这个错误的网页视图? 我在本网站中需要的部分称为:" inside2"
这是网站:http://www.dges.gov.pt/guias/detcursopi.asp?codc=8184&code=0400
我加载信息的代码:
private class MyTask extends AsyncTask<String, Integer, String> {
// Runs in UI before background thread is called
@Override
protected void onPreExecute() {
super.onPreExecute();
}
// This is run in a background thread
@Override
protected String doInBackground(String... params) {
// get the string from params, which is an array
Bundle CursoInfoData = getIntent().getExtras();
site = CursoInfoData.getString("site");
Document doc = null;
try {
doc = Jsoup.connect(site).get();
} catch (IOException e) {
e.printStackTrace();
}
ele = doc.select(".inside2");
return "start";
}
// This is called from background thread but runs in UI
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
// Do things like update the progress bar
}
// This runs in UI when background thread finishes
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
String text = "<html><head>"
+ "<style type=\"text/css\">body{color: #01A9DB; background-color: #FFFFFF;}"
+ "</style></head>"
+ "<body>"
+ ele.toString()
+ "</body></html>";
cursoInfoWeb.loadData(text, "text/html", "utf-8");
}
答案 0 :(得分:2)
我猜你有utf-8问题。使用此:
cursoInfoWeb.loadDataWithBaseURL(null, text, "text/html", "UTF-8", null);
参考:SO answer