How to zoom in/out an drawable imageView on some condition satisfied
helo, I am new to android and trying to implement some action. I have one drawable image set in imageview. I would like to zoomIn it at some specific Coordinates on ImageView When some condition (specified) is satisfied. And on satisf开发者_开发技巧ying some other condition I like to zoom Out that image. how can I achieve this functionality. Can any one help me...please.
You have to create an empty mutable bitmap object as described below and you can do alterations to this bitmap and then setImageBitmap using imageview.
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
Bitmap alteredBitmap = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), bmp.getConfig());
Canvas canvas = new Canvas(alteredBitmap);
Paint paint = new Paint();
Matrix matrix = new Matrix();
matrix.setScale(1.5f, 1.0f,0, 0);
canvas.drawBitmap(bmp, matrix, paint);
ImageView image = (ImageView)findViewById(R.id.image);
image.setImageBitmap(alteredBitmap);
精彩评论