我想使用Android WebView显示此网页,但WebView不会显示网页的完整内容。
我启用了javascript,但仍然没有显示某些项目:
public class MyCustomListView extends Activity {
private WebView webView;
private Button refresh;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_custom_list_view);
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.loadUrl("http://192.168.1.60/george-steuart/van/drawWeb?wuid=40da9b9ed74f672c3871d76a2c87857b");
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
refresh = (Button) findViewById(R.id.btn_back);
refresh.setOnClickListener(new View.OnClickListener() {
public void onClick(View mView) {
webView.loadUrl("http://192.168.1.60/george-steuart/van/drawWeb?wuid=40da9b9ed74f672c3871d76a2c87857b");
}
});
}
}
答案 0 :(得分:0)
使用下面的代码
private ProgressDialog progDailog;
progDailog = ProgressDialog.show(MyCustomListView.this, "Loading",
"Please wait...", true);
progDailog.setCancelable(false);
WebView webView = (WebView) findViewById(R.id.webView1);
webView .getSettings().setJavaScriptEnabled(true);
webView .getSettings().setLoadWithOverviewMode(true);
webView .getSettings().setUseWideViewPort(true);
webView .loadUrl("http://192.168.1.60/george-steuart/van/drawWeb?wuid=40da9b9ed74f672c3871d76a2c87857b");
// following lines are to show the loader untile downloading
// file for view.
webView .setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
progDailog.show();
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, final String url) {
progDailog.dismiss();
}
});
答案 1 :(得分:0)
function getField() {
id++;
document.getElementById("hide").value = id;
$('#tbl1').append(
'<tr id="select_row_' + id + '">'
+ '<td><img algn="center" src="' + URL + '../../../public/images/add.png" width="30" height="30" alt="add" id="addrow_' + id + '" onclick="getField();" /></td>'
+ '<td><input type="text" style="border-radius: 5px;height: 35px;width: 200px" id="item_name_' + id + '" placeholder="Select Item" autocomplete="off" onfocus="getMaterial(' + id + ')" ></td>'
+ '<td><input type="text" style="border-radius: 5px;height: 35px;width: 100px" name="qty_' + id + '" id="qty_' + id + '" placeholder="Input Quantity"></td>'
+ '<td><img src="' + URL + '../../../public/images/remove.png" id="addrow_' + id + '" onclick="remove_data_row(' + id + ');" width="20" height="20" alt="add"/></td>'
+ '<input type="hidden" id="iid_' + id + '" name="iid_' + id + '"/>'
+ '</tr>'
);
}
这是java脚本代码。这个URL变量的问题在web浏览器上有效。但是在webview中没有。他(Web开发人员)改变它并给出绝对路径。现在它可以工作。
答案 2 :(得分:-1)
使用服务器而不是在LAN上检查
答案 3 :(得分:-1)
确保您在清单文件
中授予互联网权限