繁体   English   中英

Android WebView无法加载网页

[英]Android webview can not load web pages

我无法使用webview加载网页,未显示任何内容,此网址为“ http://dev.51yunche.com:7000/WeChat/Service%20introduce.html ”,这是我的webview

    webView = (WebView) findViewById(R.id.drive_web);
            webView.setWebViewClient(new WebViewClient());
            webview.getSettings().setJavaScriptEnabled(true);
            webView.getSettings().setAppCacheEnabled(true);
            webView.getSettings().setDomStorageEnabled(true);//DOM Storage
        webView.loadUrl("http://dev.51yunche.com:7000/WeChat/Service%20introduce.html");

此xml:

 <WebView
            android:id="@+id/drive_web"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />

控制台没有任何提示或错误消息。我想听听经验丰富的WebView用户(和开发人员?)的一些意见。

先感谢您!

这不是webview问题。在Web浏览器中,该网址也显示Nothing。请检查您的html文件的后端或设计代码。

您的网址中有一个空格编码字符%20 ...

使用有效的网址,例如:

 webView.loadUrl("http://dev.51yunche.com:7000/WeChat/Serviceintroduce.html");

另外,您也可以尝试URLEncoder.encode(YOUR_URL); 编码网址的函数

您的链接本身在网络浏览器中不显示任何内容。 如果您仍然有任何疑问,只需自己创建一个普通的html页面,然后从本地系统运行它,然后将其检出即可。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM