I am new to Android and I have to create one android application that shows the images from the server. I want to apply zoom effects on button click. I have two buttons one for zoom in and another is form zoom out. I want to apply zoom in or out on click of related button click. I searched a lot but did not find any thing related to my specific case. I have so far implemented imageview.onTouchlisterner()
for zoom effects but I don't want this I want to do zoom on button click so please help me. Thank you in advance.
Asked
Active
Viewed 617 times
1

Skynet
- 7,820
- 5
- 44
- 80

nishitpatel
- 652
- 4
- 9
- 25
1 Answers
0
a very simple technique that i used for such purpose, make a webview and load you image using its url into that webview on image clicked like this:
WebView web=(WebView)findViewById(R.id.web);
mProgress = ProgressDialog.show(this, "Please wait!", "Loading image and zoom controlls...");
web.getSettings().setLoadWithOverviewMode(true);
web.getSettings().setUseWideViewPort(true);
web.getSettings().setBuiltInZoomControls(true);
WebSettings settings = web.getSettings();
settings.setJavaScriptEnabled(true);
String url=getIntent().getExtras().getString("imageURL");
web.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
// when finish loading page
public void onPageFinished(WebView view, String url) {
if(mProgress.isShowing()) {
mProgress.dismiss();
}
}
});
web.loadUrl(url);
}

Saad Asad
- 2,528
- 3
- 20
- 27
-
thank you for your replay @Saad Khokhar but i only want it for image view i don't want to use any other control – nishitpatel Apr 05 '13 at 10:39
-
you will have to use any other controll to get what you want, this is easiest possible solution – Saad Asad Apr 05 '13 at 10:42
-
ofcorse there are other ways out, look into these links [link](http://vinnysoft.blogspot.com/2009/08/zooming-imageview.html) [link](http://stackoverflow.com/questions/6650398/android-imageview-zoom-in-and-zoom-out) – Saad Asad Apr 05 '13 at 10:50