Webview "fit image"

wimpie3

Well-Known Member
Licensed User
Longtime User
I'm using a Webview to show an image. However, part of the image is cropped because the image is too large to fit the screen. Can I instruct Webview to show the entire image by default. A kind of "zoom to fit"? It's ok if you zoom in afterwards using your fingers, but I want the entire image to be visible the first time.
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Because a webview supports image zooming by default. And I absolutely need that.
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
This trick may help:

Dim wv as Webview
wv.LoadHtml("<html><body><img src='file:///android_asset/yourpicture.jpg' width='100%' height='100%'/></body></html>")

Note that you should add "yourpicture.jpg" into your package (using Files tab).
 
Upvote 0

wimpie3

Well-Known Member
Licensed User
Longtime User
This seemed a good solution at first, but the pinch-zoom function is not working anymore when you set the image width and height to 100%.
 
Upvote 0
Top