I want to make a simple thing: put 3 images in one layout – One is on the left, second is in the middle, third is on the right.
Here is my code:
<LinearLayout android:id="@+id/linearV"
android:background="@drawable/gradientbg"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="50dip"
>
<ImageView android:id="@+id/headerimage1"
android:layout_height="fill_parent"
android:layout_width="100dip"
android:src="@drawable/image1"
android:scaleType="fitXY"/>
<ImageView android:id="@+id/headerimage2"
android:layout_height="fill_parent"
android:layout_width="100dip"
android:src="@drawable/image2"
android:scaleType="fitXY"/>
<ImageView android:id="@+id/headerimage3"
android:layout_height="fill_parent"
android:layout_width="100dip"
android:src="@drawable/image3"
android:scaleType="fitXY"
/>
</LinearLayout>
I’ve tried to add the : “android:gravity” tag to each ImageView but it doesn’t seem to have any effect.
Intead of LinearLayout you should use Relative Layout,