gpt4 book ai didi

android - webview 不适用于所有域

转载 作者:行者123 更新时间:2023-11-29 02:36:01 27 4
gpt4 key购买 nike

我正在尝试在我的应用程序 (android Studio) 中实现一个 webview。这很容易。不幸的是,并非所有域都已加载:

    String url="https://www.secretdomain.ch/"; //sorry i must remove the domain
webView=(WebView)rootView.findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(false);
webView.loadUrl(url);

这行不通,没有页面加载。

当我尝试 https://www.google.ch/https://stackoverflow.com/一切正常。

这可能是什么原因?我不认为这是网站本身,因为在 ios (Xamarin) 上,webview 工作没有任何问题。有解决方法吗?

最佳答案

这样试试

xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#ff00ff">
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>

类(class):

{
{
wb=(WebView)findViewById(R.id.webView1);
wb.loadUrl("https://www.dkh.ch/");
wb.setWebViewClient(new WebViewClient());

}
}

关于android - webview 不适用于所有域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47051291/

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