我正在尝试在 a 中加载网页WebView
,但是当检索该页面时,我丢失了所有样式信息,可能是我的 Web 视图中未正确使用 CSS 文件。
为了检索我HTTP POST
以这种方式使用的数据:
public void postData() throws IOException, ClientProtocolException {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("param1", "parameter1"));
nameValuePairs.add(new BasicNameValuePair("param2", "parameter2"));
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(URL_STRING);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
String data = new BasicResponseHandler().handleResponse(response);
WebView mWebView = (WebView) findViewById(R.id.wv);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadData(data, "text/html", "utf-8");
}
我怎么解决这个问题?