How to Zoom Only Image in Android Webview Onclick on Image?

Viewed 189

In my app only page gets zoom. How to Zoom any images in android webview on tapping image. Please help me with an example source code.

1 Answers

BINGO!!! I found a temporary solution to this problem. Injected custom CSS to android Webview and I was able to scale image.

 contentText = new StringBuilder().append(AppConstant.CSS_PROPERTIES).append(contentText).toString();
                    webEngine.loadHtml(contentText);

And I customized CSS properties in java class file. When I tap on the image it gets scaled by 150%

 public static final String CSS_PROPERTIES = "<style>" +
            "img:hover{transform: scale(1.5) rotate(270deg); transition:0.5s ease;margin-left:auto;margin-right:auto;}"
            + "</style>" ;

Any Suggestion please comment.

Related