In this article, I am going to teach you can use Multi-touch with Image View in Android to replicate Gallery feature. So let’s begin.
DescriptionAn Image View with touch can be used to make a great tool that provides zooming and panning an image inside it. So that the user can view very large images inside a small screen.In Android, we all have seen the builtin Gallery. It provides pinch zoom & pan. But it is provided by the builtin Gallery. How can we provide that feature in our application? Here is how.In this article, I am explaining how to use Multi-touch with Image View in Android to replicate the Gallery feature. So let's begin.Step 1Create a project with the following parameters.Step 2Now, the following is the code to add multi-touch pinch, zoom and panning features to the Image View. Copy the entire code and paste it into your package or make a class file named "TouchImageView" and paste code inside it.TouchImageView.java
You can see that we have extended the ImageView so that all the features of the ImageView can be used in the current class. Step 3Search any large image (not too large otherwise the heap will not handle it) and put it in the "drawable-hdpi" directory. In my case the image is "ice_age_2.jpg".Step 4Open your main activity file and paste the following code into it.MultiTouchActivity.java
Pro WPF: Windows Presentation Foundation in .NET 3.0