PhotoView
PhotoView copied to clipboard
How to close dialog on click outside the image
I'm using PhotoView inside a full screen dialog like this
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/photo_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
The PhotoView width and height are set to match_parent and hence cover the entire screen. If image proportions differ from the screen ones then image is scaled to fit in the center and there will be some unused space in the view. When user clicks on the view, is it possible to detect if the click was done outside the actual image to close the dialog?

have a look at setOnOutsidePhotoTapListener method