Example usage for android.webkit WebView requestLayout

List of usage examples for android.webkit WebView requestLayout

Introduction

In this page you can find the example usage for android.webkit WebView requestLayout.

Prototype

@CallSuper
public void requestLayout() 

Source Link

Document

Call this when something has changed which has invalidated the layout of this view.

Usage

From source file:im.vector.adapters.ImagesSliderAdapter.java

private void loadImage(WebView webView, Uri imageUri, String viewportContent, String css) {
    String html = "<html><head><meta name='viewport' content='" + viewportContent + "'/>"
            + "<style type='text/css'>" + css + "</style></head>" + "<body> <div class='wrap'>" + "<img "
            + ("src='" + imageUri.toString() + "'") + " onerror='this.style.display=\"none\"' id='image' "
            + viewportContent + "/>" + "</div>" + "</body>" + "</html>";

    String mime = "text/html";
    String encoding = "utf-8";

    webView.loadDataWithBaseURL(null, html, mime, encoding, null);
    webView.requestLayout();
}

From source file:im.neon.adapters.VectorMediasViewerAdapter.java

/**
 * Update the image page.//from  w  ww. java 2s . c om
 * @param webView the image is rendered in a webview.
 * @param imageUri the image Uri.
 * @param viewportContent  the viewport.
 * @param css the css.
 */
private void loadImage(WebView webView, Uri imageUri, String viewportContent, String css) {
    String html = "<html><head><meta name='viewport' content='" + viewportContent + "'/>"
            + "<style type='text/css'>" + css + "</style></head>" + "<body> <div class='wrap'>" + "<img "
            + ("src='" + imageUri.toString() + "'") + " onerror='this.style.display=\"none\"' id='image' "
            + viewportContent + "/>" + "</div>" + "</body>" + "</html>";

    String mime = "text/html";
    String encoding = "utf-8";

    webView.loadDataWithBaseURL(null, html, mime, encoding, null);
    webView.requestLayout();
}