In this article, PhotoView is added in android. PhotoView aims to help produce an easily usable implementation of a zooming Android ImageView using multi-touch and double-tap. Besides that, it has many more features like it notifies the application when the user taps on the photo or when the displayed matrix gets changed. It provides smooth scrolling even when a scrolling parent container like ViewPager is used. It can be used in the gallery app.
Step 1: Add the support Library in your root build.gradle file (not your module build.gradle file). This library jitpack is a novel package repository. It is made for JVM so that any library which is present in github and bigbucket can be directly used in the application.
Step 2: Add the support library in build.gradle file and add the dependency in the dependencies section. It allows the developer to use the PhotoView directly in XML files.
Step 3: Add the following code in the activity_main.xml file. In this file, PhotoView is added to the layout.
Step 4: Add the following code in the MainActivity.java file. In this file, we add image to our PhotoView. setImageResource() method is used to add the image in PhotoView.
Refer to the official documentation for more information.