I am writing an image viewer that downloads a PNG from a remote server, 
saves it to storage, and then opens it in a WebView so that I get 
multi-touch zoom for free. These images are usually going to be documents, 
so the user will want to be able to zoom in very far. I am sending down 
images of sufficient resolution to enable this, but the WebView seems to be 
"helping" me by scaling my image to the screen size to start out with. This 
means that my image is much too low resolution to be properly zoomed in on. 

I have searched around for this, and I have found some other people 
encountering a similar<../d/msg/android-developers/ZXiqdqa8Tos/I_J8YR1As94J> 
problem <../d/topic/android-developers/oc4e-SwFJbY/discussion>, but the only 
possible solution I found was to cut the image up into tiles and reassemble 
them using HTML before loading it in the view. This seems like a kludge, and 
I am asking if anyone has either a way to turn off that scaling, or an 
alternative method to get what I need.

The code that initializes the WebView:

viewer = (WebView)findViewById(R.id.activity_imageviewer_webview);
viewer.setBackgroundColor(0);
WebSettings settings = viewer.getSettings();
settings.setJavaScriptEnabled(false);
settings.setBuiltInZoomControls(true);
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);

The code that loads the image into the WebView:

viewer.loadUrl(Uri.fromFile(imageFile).toString());

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to