Quickly solve the problem that android webview https pictures are not displayed

  • 2021-09-24 23:39:58
  • OfStack

Android webview starting from Lollipop (5.0), webview does not allow mixed mode by default, and http resources cannot be loaded in https, so it needs to be set and turned on.

Solution:


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      webview.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
    }

Related articles: