Android Question Image Zoom & Pitch

fishwolf

Well-Known Member
Licensed User
Longtime User
I'm tring to use the webview for show a image and zoom it.

if i set the image url, i cannot manage the image size, the big image is showed only a part.

if i set a html page with img tag i can set width and height parameters.

The problem is find the right value for this parameter,
for a display size of 480x800 the image size for a big image to full screen is 305x515.

Can i calculate this value for other phones and display size?

I have already use TouchImageView with bad result.

B4X:
Dim ImageWidth As Int
Dim ImageHeight As Int
 
    Activity.LoadLayout("main")
       
    WebView1.Width = 100%x
    WebView1.Height = 100%y
    
    ImageWidth = 305
    ImageHeight = 515
    
 
    WebView1.LoadHtml("<html><head></head><body><img src='http://www.domain/big-image.jpg' width='" & ImageWidth & "' height='" & ImageHeight & "'></body></html>")
 
End Sub
 

eurojam

Well-Known Member
Licensed User
Longtime User
you can work with relative values e.g. width: 100% see below
B4X:
WebView1.LoadHtml("<html><head></head><body><img src='https://www.b4x.com/images/b4i_bubble.png' style='width: 100%;'></body></html>")
 
Upvote 0

fishwolf

Well-Known Member
Licensed User
Longtime User
in this mode the image is showed all, but isn't possibile zoom in, return always to start view.

The ImageView component don't manage the standard gesture as in native java?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…