Issue
I have an app that uses webview to display a set of images. Here is an example of an url that I use: http://butek.nu/mattilbud/butikker/oslo/meny/
The problem with android 4.4 is that it is not possible to zoom on the images anymore.. Have tried reading a bit on here: http://developer.android.com/guide/webapps/migrating.html. The viewport is good, the images scales good, but not possible to zoom in any way.(double pinch or multigestures). Here are some of the settings on my webview:
wv = (WebView) findViewById(R.id.webView1);
wv.getSettings().setLoadWithOverviewMode(true);
wv.getSettings().setUseWideViewPort(true);
wv.getSettings().setDomStorageEnabled(true);
wv.getSettings().setSupportZoom(true);
wv.getSettings().setBuiltInZoomControls(true);
wv.getSettings().setDisplayZoomControls(false);
Tried with none of them and then putting one and one "on" again.
Any solutions? Thanks.
Solution
You may have the WebView's LayoutParams.height set to WRAP_CONTENT. This causes the viewport width to be recalculated at the end of every pinch zoom. Because you have your images set to be width:100%, after pinch-zoom they resize back to being as wide as the viewport.
Per the WebView documentation - you should not be mixing WRAP_CONTENT and pinch-zooming. Set the WebView's layoutParams to something other than WRAP_CONTENT and this should work fine.
If I'm guessing incorrectly and you still have problems try removing the img { width:100%; }
CSS rule.
Answered By - marcin.kosiba
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.