How do I make my ImageView a fixed size regardless of the size of the bitmap
This will fit the image in the specified height and width, irrespective of image size.
<ImageView
android:id="@+id/image5"
android:layout_width="300dp"
android:layout_height="200dp"
android:src="@drawable/image_1"
android:scaleType="fitXY"/>
Just delete the maxHeight
and maxWidth
attributes and enter your units in layout_width
and layout_height
appropriately. But do not use the px
unit - use dp
instead, because these are device-independent.