Android Question Different height of PNG-Image in webview

welu1805

Active Member
Licensed User
Longtime User
Hi all,

I load a PNG-Image to the webview WV1. Here is a sniplet of my code:

Dim WV1 as WebView
Dim MyWebViewExtras as WebViewExtras
Dim MyWebViewExtends as WebViewExtends

' "bildDir" is a folder on the external SD-card
' "bildDatei" is a PNG-image in this folder

s = "<html><body><img src='file://"& bildDir & "/" & bildDatei & "' width=100% /></body></html>"
WV1.ZoomEnabled = False
WV1.LoadHtml(s)

With MyWebViewExtras.GetContentHeight(WV1) I get 5336.

I scroll the image down to the bottom with my fingers.

With MyWebViewExtends.getScrollY(WV1) I get 8720 (and this is the the top of the screen, the screen
height is additional to 8720)

Which value is the correct height? I need it to scroll the image in the webview programatically. In the
library "WebViewExtends" there is no method or property to get the height.
 

welu1805

Active Member
Licensed User
Longtime User
sorexTod post: 314443 said:
what is the purpose of having it in a webview?
The image is to large for a bitmap. LoadBitmapSample reduces the resolution Tod strong.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
never used the resample but maybe it has anti-alias/smoothing turned off?

the normal bitmap draw has the same problem with strange looking results unless you enable it.
 
Upvote 0

welu1805

Active Member
Licensed User
Longtime User
never used the resample but maybe it has anti-alias/smoothing turned off?

the normal bitmap draw has the same problem with strange looking results unless you enable it.
Sorry, but I don't know what do you mean with "anti-alias/smoothing". How can I turn off/on?
 
Upvote 0

welu1805

Active Member
Licensed User
Longtime User
Sorry, but I don't know what do you mean with "anti-alias/smoothing". How can I turn off/on?
I found some posts about "anti-aliasing" by search in the forum. But I think it don't solve my problem: I need the real hight ob the webviews content.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
give the image an id and you could get it with javascript(/jquery) calls.
 
Upvote 0

welu1805

Active Member
Licensed User
Longtime User
give the image an id and you could get it with javascript(/jquery) calls.
My, knowledge abaout javascript is not enough ...

I found a solution with WebViewExtra: GetContentHeight * GetScale is the height of the image within WebView.
 
Upvote 0
Top