我正在尝试将 html 文件加载到 webview 中,但 webview 保持空白。有人可以帮我实现这一目标吗?
这是我的html
<script src="http://france.meteofrance.com/portlet/plugins/meteo/VignetteMeteoVille3.javascript?idLieu=431200" charset="UTF-8"></script>
这是在创建方法上
//oncreate方法
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.rss_feed);
webcontent = (WebView)findViewById(R.id.webViewHistoire);
webcontent.setWebViewClient(new NewsClient());
webcontent.getSettings().setJavaScriptEnabled(true);
webcontent.getSettings().setPluginsEnabled (true);
webcontent.getSettings().setDomStorageEnabled(true);
webcontent.loadUrl("file:///android_asset/home.html");
}
//返回键
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && webcontent.canGoBack()) {
webcontent.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
private class NewsClient extends WebViewClient {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}
}