简体   繁体   中英

How to make an ImageView popup on click

I want to be able to click on an ImageView in a list and have it popup on click, like in the Tumblr and Path app.

Does anyone know how this can be done?

PS: I've tired using a dialog already.

I know its old question. but ill add this for future reference. You can use this library to show image as a Popup. https://github.com/chathuralakmal/AndroidImagePopup

final ImagePopup imagePopup = new ImagePopup(this);

    final ImageView imageView = (ImageView) findViewById(R.id.imageView);
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            /** Initiate Popup view **/
            imagePopup.initiatePopup(imageView.getDrawable());
        }
    });

There's a component called PopupWindow , you can find some example of usage here: http://android-er.blogspot.com.br/2012/03/example-of-using-popupwindow.html

It is slightly similar to a Dialog, but you have more control over it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM