Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to resize an ImageView Programmatically

I want to resize an ImageView when I touch on it. It will be perfect to resize it like when you do the zoom in google maps or in a mobile browser but if just touching it I can resize it will be enough. Is that possible?

like image 355
Iban Arriola Avatar asked Jan 11 '13 17:01

Iban Arriola


1 Answers

Just catch the event of touching this ImageView and than just adjust height & weight :

touched_image_view.getLayoutParams().height += 20;
touched_image_view.getLayoutParams().width += 20;

Or you can just create and set new LayoutParams :

LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(100, 100);
touched_image_view.setLayoutParams(layoutParams);

Hope it helps.

like image 110
EvZ Avatar answered Dec 02 '22 18:12

EvZ