3

I was using Picasso for a while now and I'm very satisfied with it. However I'm in need of enlarging an imageview's image which was loaded by Picasso. As in, I simply want to create a zoomImageFromThumb of the image. However the traditional zoomImageFromThumb requires a resource to be present in the project. In my case, Picasso loads it up.. so how do I enlarge an image laoded by Picasso on click of the image view?

My code so far:

ImageBanner= (ImageView) findViewById(R.id.lb_single_image);
Picasso.with(ctx)
        .load("www.flickr.com/randomimage.jpg")
        .placeholder(R.drawable.loading_placeholder)
        .error(R.drawable.error_placeholder)
        .into(ImageBanner);
ImageBanner.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //how do I enlarge the picasso image?
            }
        });
Al Lelopath
  • 6,448
  • 13
  • 82
  • 139
Pjayness
  • 365
  • 1
  • 6
  • 22

1 Answers1

1

Instead of setOnClickListener() you can use PhotoViewAttacher:

    ImageBanner= (ImageView) findViewById(R.id.lb_single_image);
Picasso.with(ctx)
        .load("www.flickr.com/randomimage.jpg")
        .placeholder(R.drawable.loading_placeholder)
        .error(R.drawable.error_placeholder)
        .into(ImageBanner);

PhotoViewAttacher mAttacher = new PhotoViewAttacher(ImageBanner);

Only one line, and it will works.

Olga Akhmetova
  • 490
  • 1
  • 6
  • 19