Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to close dialog on click outside the image #737

Open
yaugenka opened this issue Jan 19, 2020 · 1 comment
Open

How to close dialog on click outside the image #737

yaugenka opened this issue Jan 19, 2020 · 1 comment

Comments

@yaugenka
Copy link

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?

Screenshot_1579431662

@daniel-micic
Copy link

have a look at setOnOutsidePhotoTapListener method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants