I have a page. It loads the images from server and displays on screen in pairs of four. Some images are larger and smaller in size. The problem is that when the image is large, the imageview stretches itself to the actual size of image. I want that what matter the size of image, it must fit in the imageview without disturbing the other 3 images. Its xml is”
<LinearLayout android:id="@+id/videolist"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/trendingnowmanual"
android:layout_above="@+id/navigatevideo"
android:gravity="center_vertical|center_horizontal"
android:background="#ffffff"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="5dip"
android:layout_marginBottom="5dip" >
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="10dip"
android:layout_marginBottom="5dip"
android:layout_weight="100">
<ImageView android:id="@+id/one"
android:src="@drawable/add1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dip"
android:layout_weight="50"
android:adjustViewBounds="true"
>
</ImageView>
<ImageView android:id="@+id/two"
android:src="@drawable/add2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dip"
android:layout_weight="50"
android:adjustViewBounds="true"
>
</ImageView>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="5dip"
android:layout_marginBottom="10dip"
android:layout_weight="100" >
<ImageView android:id="@+id/three"
android:src="@drawable/add3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dip"
android:layout_weight="50"
android:adjustViewBounds="true"
>
</ImageView>
<ImageView android:id="@+id/four"
android:src="@drawable/add4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dip"
android:layout_weight="50"
android:adjustViewBounds="true"
>
</ImageView>
</LinearLayout>
</LinearLayout>
Any idea?
use scaleType=”fitXY” in your imageview