即使没有错误,java Webview也不会显示
我的应用程序有一个网络视图。什么都没有,只是一个约束布局的webview和一个网站,并将权限设置为internet。为什么我的应用程序上仍然有一个空白页? 我的代码: 显示
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
package="----">
<uses-permission 安卓:name="安卓.permission.INTERNET"></uses-permission>
<application
安卓:allowBackup="true"
安卓:icon="@mipmap/ic_launcher"
安卓:label="@string/app_name"
安卓:roundIcon="@mipmap/ic_launcher_round"
安卓:supportsRtl="true"
安卓:theme="@style/AppTheme">
<activity 安卓:name=".MainActivity">
<intent-filter>
<action 安卓:name="安卓.intent.action.MAIN" />
<category 安卓:name="安卓.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
我的密码
package com.-----.samudrafootwearstore;
import 安卓x.appcompat.app.AppCompatActivity;
import 安卓.os.Bundle;
import 安卓.webkit.WebView;
import 安卓.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
WebView wb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
wb = findViewById(R.id.samudrafootwearpage);
wb.setWebViewClient(new WebViewClient());
wb.loadUrl("www.google.com");
}
}
和布局:
<?xml version="1.0" encoding="utf-8"?>
<安卓x.constraintlayout.widget.ConstraintLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:app="http://schemas.安卓.com/apk/res-auto"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
tools:context=".MainActivity">
<WebView
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:id="@+id/samudrafootwearpage"
/>
</安卓x.constraintlayout.widget.ConstraintLayout>
logcat:
2020-07-16 23:05:02.661 29736-29743/? E/art: Failed sending reply to debugger: Broken pipe
2020-07-16 23:05:03.053 29736-29783/? E/libEGL: validate_display:300 error 3008 (EGL_BAD_DISPLAY)
谁能帮我一下吗。 谢谢
# 1 楼答案
它将起作用,而不是
wb.loadUrl("www.google.com");
dowb.loadUrl("http://www.google.com")