Loading Image in a webview , Resizing, Pinch Zooming etc. - Android
I have a listview in my main activity, selecting an item sends the index
number as intent - Which I use in my "Image-Displayer" activity to pick up
the corresponding URL from an Array of URLs with the same index position.
(Read it again).. :p
I don't want any buttons in my Image activity, Right now I just have a
webview and want to keep it that way.
Here's my java on loading the URL (in OnCreate):
WebView myWebView = (WebView) findViewById(R.id.ww);
myWebView = new WebView(this);
/////// myWebView.getSettings().setLayoutAlgorithm(
////// LayoutAlgorithm.SINGLE_COLUMN);
myWebView.loadUrl("http://www.google.com");
myWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
setContentView(myWebView);
Trouble is - See those comments in the 3,4 lines ? If I remove the comment
marks, (That is, use the function)... It sets the page at the URL to
whatever size the screen is - A perfect fit. (I want this) But, the pinch
zoom built into the webview is disabled(don't want this)
If I don't use this function, The webpage doesn't size up according to the
screen (Don't want this)... But, the inbuilt pinch zoom is still there (I
want this)
So, I'm looking for best of both worlds - The URL(containing image) should
size up to match the mobile's screen size, but the pinch zoom should also
be available.
Any idea how to do this ?
Thank you.
(Side question - How to implement Right, left swipes ? I want to use that
to move to the next or previous URL) (couldn't wait 20 mins to ask this
separately XD)
Pls help :)
No comments:
Post a Comment