IDEAndroid StudioUse Iframes

Using Iframes in Android Apps

To load an iframe in an Android App, you can use the “loadData” param with the html mime type like this:

    WebView myWebView = (WebView) findViewById(R.id.displaymap);
    WebSettings webSettings = myWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    myWebView.setWebViewClient(new WebViewClient());
 
    String html = "<iframe style=\"width:100%;height:100%;border:none;border-radius:.5rem;\" " +
        "src=\"https://example.com\" ></iframe>";
 
    myWebView.loadData(html, "text/html", null);