电脑联网,AVD自带的浏览器可以上网,已经在AndroidManifest.xml里面配置了用户权限,但是我的webview控件依旧无法加载指定的网页,显示weblage not available,请问是为什么呢?
我的源码如下:(非常简单基础的webview使用)
AndroidManifest.xml 已经设置用户权限!
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.webviewtest">
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.java
package com.example.webviewtest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView Filter_items = (WebView)findViewById(R.id.Filter_items);
Filter_items.getSettings().setJavaScriptEnabled(true);
Filter_items.setWebViewClient(new WebViewClient());
Filter_items.loadUrl("https:/www.baidu.com");
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.webviewtest.MainActivity">
<WebView
android:id="@+id/Filter_items"
android:layout_width="match_parent"
android:layout_height="match_parent">
</WebView>
</android.support.constraint.ConstraintLayout>
诚心请教!