android - WebView and scale image -


I am creating a webview in code. In this webview I show the picture. Now I have two questions, how do I complete the image I can show in, because the resolution of my pictures is 1381x1829 and I see only one part of this picture. And second one. As you can see in the code I load photos from the property, but I want to load the photos from the SD card. How can I do this?

This code is:

  webview web = new webview (getContext ()); Web.getSettings () setJavaScriptEnabled (true). . Web.getSettings () setBuiltInZoomControls (true); Web.loadUrl ("File: ///android_asset/lj.png"); AddView (web);    

this method webview.getSettings (). SetBuiltInZoomControls (true) will allow you to implement the zoom control for non-multitattate screens

You can load image from sdcard to webview anywhere using this code. This is that if you want to load many images from multiple locations

  string base = environment GettyStorySeries Directory () GetAbsolutePath () ToString () + "/ Your / Folder"; String imagepath = "file: /" + base + "/ test.jpg"; String html = "<">       

But if you want to load the image, it is present in the same root folder, it will move

  string imagePath = "test.jpg "; String html = "<">       

WARNING, if you try to load the Hi-Raze image as 1600x1840 for the webview, webview will reduce the image resolution to maintain memory usage, as a result Red image will appear

Comments