Android Question Different height of PNG-Image in webview

Discussion in 'Android Questions' started by welu1805, Feb 6, 2015.

  1. welu1805

    welu1805 Active Member Licensed 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.
     
  2. sorex

    sorex Expert Licensed User

    what is the purpose of having it in a webview?
     
  3. welu1805

    welu1805 Active Member Licensed User

    The image is to large for a bitmap. LoadBitmapSample reduces the resolution Tod strong.
     
  4. welu1805

    welu1805 Active Member Licensed User

    "to" strong ...
     
  5. sorex

    sorex Expert Licensed 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.
     
  6. welu1805

    welu1805 Active Member Licensed User

    Sorry, but I don't know what do you mean with "anti-alias/smoothing". How can I turn off/on?
     
  7. welu1805

    welu1805 Active Member Licensed User

    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.
     
  8. sorex

    sorex Expert Licensed User

    give the image an id and you could get it with javascript(/jquery) calls.
     
  9. welu1805

    welu1805 Active Member Licensed User

    My, knowledge abaout javascript is not enough ...

    I found a solution with WebViewExtra: GetContentHeight * GetScale is the height of the image within WebView.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice