android - webview 不适用于所有域

标签 android android-webview

我正在尝试在我的应用程序 (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/

相关文章:

安卓工作室 : build on debug but not on release

android - SQL 数据库中未添加数据

javascript - 使用 Javascript 在 WebView 中填写表单

android - 在 webview 中使用 ShowfindDialog 搜索不突出显示

java - 使用 Retrofit 2 将图像从图库/相机上传到服务器(okhttp 问题)

java - android-pulltorefresh 小部件的问题

android - TextInputEditText 无法转换为 TextInputLayout

android - 创建点击 WebView 链接的 Intent

android - Webview 在右侧添加空白

Android WebView在某些手机上无法显示html表格的右边框