我对 webview 的体验很差,它无法加载我请求的网页。
我无法加载谷歌或任何其他带有网络视图的页面。我已经放入了xml:
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_marginLeft="250px"
android:layout_marginTop="80px"
android:layout_width="180px"
android:layout_height="160dip"
/>
然后我输入代码:
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
这显示网页不可用。
我还将权限添加到清单中。
我在此应用程序中还有另一个活动,它使用以下方式加载 YouTube 网址:
startActivity(new Intent( Intent.ACTION_VIEW,
Uri.parse("http://www.youtube.com/watch?v=XS998HaGk9M")));// Starts an intent to watch the video
我不确定这可能是什么,并且确实需要这方面的建议,因为我需要让它工作。
Thanks
编辑:我也无法访问实际模拟器本身内的任何网页。通过在模拟器内的搜索栏中搜索,这在连接到 Google 时会说同样的事情。
我不知道为什么这会以意图而不是网络视图连接到 youtube
编辑:这现在甚至没有连接到 youtube,它说与上面相同。这很混乱,因为我明天需要它来为我的项目工作。如果网络视图持续下降,这不是很可靠。我可能必须更换我正在使用的设备,因为 Android 设备总是出问题。
编辑:几个小时后我刚刚回来,没有接触代码或模拟器,当我运行应用程序时,YouTube 视频又回来了,我可以在模拟器中浏览。但我仍然无法通过 webview 连接。非常不可靠:(