gpt4 book ai didi

java - 我的 webView Activity 显示空白

转载 作者:行者123 更新时间:2023-11-29 04:41:24 24 4
gpt4 key购买 nike

我正在尝试在我的 android Activity 中添加 webview,但它的 Activity 页面不显示我给定的 url 请帮助我。?

DMS.java

  package com.agte.vivo;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;


public class Dms extends Activity {

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dms);
WebView myWebView = (WebView) findViewById(R.id.webView);
//myWebView.loadData("yourCode Html to load on the webView " , "text/html" , "utf-8");

myWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}});
myWebView.loadUrl("192.168.7.175/app/app.html");

}


}

Activity 数据管理系统

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.agte.vivo.Dms">


<WebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true" />
</RelativeLayout>

没有显示错误,但我需要在 android 应用程序中打开相同的网页如何解决这个问题。?

最佳答案

您是否在 list 文件中添加了这一行?

<uses-permission android:name="android.permission.INTERNET" />

关于java - 我的 webView Activity 显示空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39075171/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com