Android, cambiar el tamaño de la imagen en ImageView

For Android, How can I change the image size in an ImageView in a layout?

Mi imagen es jpeg formato.

preguntado el 25 de agosto de 12 a las 17:08

4 Respuestas


Just change width and height attribute.

Respondido 28 ago 13, 08:08

i have a problem in that : when i am increasing the height attribute, only image view's height is increasing but image's height is not increasing - Dhruvam Gupta

Es posible que también desee configurar android: scaleType attribute to make the image scale within the ImageView (fitXY en mi caso) - Luis

You can also set Params using LayoutParams

ImageView yourImageView= (ImageView)findViewById(;

    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(30, 30);
//width and height of your Image ,if it is inside Relative change the LinearLayout to RelativeLayout.

Respondido 15 Abr '14, 14:04

There are a few ways to change the size of an image in an imageView in XML.

  1. Scale the image by pulling around the edges of the imageView in the Graphical Layout (this is not really advised since the Graphical Layout sometimes adds undesired properties into the XML).

  2. Apply a weight to the imageView (this requires the parent object to have specified a weightSum), causing the image to scale according to the screen size. This seems to be the most reliable way to gauge how your layout will look on many different sized screens.

  3. Simply adjust the weight and height in the imageView (as others have mentioned).

Respondido 28 ago 12, 05:08


sin que importe xx is the width in pixels and yy is the height in pixels.

(give integer values as you desire the size to be)

Respondido 25 ago 12, 17:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.