I want to position two ImageViews horizontally, but I am not able to get it right.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" android:scaleType="fitXY">
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/some_image" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:layout_alignBottom="@+id/imageView3"
android:src="@drawable/some_image_ontop" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content" android:scaleType="fitXY" >
<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/some_other_image" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:layout_alignBottom="@+id/imageView4"
android:src="@drawable/some_other_image_ontop" />
</RelativeLayout>
</LinearLayout>
As you can see I’m trying to stack two images on top of each other in addition to place them horizontally. Someone know what I’m doing wrong to position the two images next to each other?
To make it more simple, enclose your ImageViews inside
LinearLayoutand set its property asandroid:orientation="horizontal"For example: