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

click to dismiss #56

Open
shejishi opened this issue Aug 11, 2020 · 3 comments
Open

click to dismiss #56

shejishi opened this issue Aug 11, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@shejishi
Copy link

I want to make him disappear when I click, how can I do it?

@shejishi shejishi added the enhancement New feature or request label Aug 11, 2020
@antonshkurenko
Copy link

Please, add this functionality

@StamplerJ
Copy link

I used an overlay view to add a close button, which I could then add an OnClickListener to, to close the image viewer:

private StfalconImageViewer<String> imageViewer;

public MyClass(Activity context)
{
    this.pictureDetailsView = context.getLayoutInflater().inflate(R.layout.item_image_overlay_view, null, false);

    this.imageViewer =  new StfalconImageViewer.Builder<>(context, imageUrlList, imageLoader)
            .withStartPosition(0)
            .withOverlayView(pictureDetailsView)
    .build();

    ImageView closeImageView = this.pictureDetailsView.findViewById(R.id.ivCloseImageView);
    closeImageView.setOnClickListener(v ->
    {
        if(imageViewer != null)
        {
            imageViewer.close();
        }
    });
}

item_image_overlay_view.xml

<ImageView
    android:id="@+id/ivCloseImageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginStart="20dp"
    android:layout_marginTop="20dp"
    android:clickable="true"
    android:focusable="true"
    app:srcCompat="@drawable/ic_close"
    app:tint="@color/mea_background_90" />

@chang-guofeng
Copy link

I think a good way to do this is through . withOverlayView;

custom overlay to recognize click event

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

No branches or pull requests

5 participants