0

I am resizing an ImageView and auto fitting the image to it, I need this for zoom in and out for image, this is the way i wish to implement this because the image is already 2048x2048 and I cant re-size it. Bu the code only works once for some reason, second click does not do anything. If you have other ideas or suggestions I would love to hear them. Thank you.

ImageView map = (ImageView) findViewById(R.id.imageViewMap);
Bitmap mapIm = BitmapFactory.decodeResource(getResources(),R.drawable.myMap);
map.setImageBitmap(mapIm); //first view

zoomIn.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {


            map.getLayoutParams().height = counter*5000 ;
            map.getLayoutParams().width = counter*5000;

            BitmapDrawable bmd = new BitmapDrawable(mapIm);
            map.setImageDrawable(bmd);
            bmd = null;

            counter++;

        }
    });
Dim
  • 4,527
  • 15
  • 80
  • 139

1 Answers1

6

For zooming your image view

imageview.setScaleType(ScaleType.FIT_XY);

or you can try the following link hope it may help you

zoomableimageview

try this hope it may help you

example zoom

Community
  • 1
  • 1
Janmejoy
  • 2,721
  • 1
  • 20
  • 38