Reputation: 5391
I am trying to place two imageviews -
<ImageView
android:id="@+id/ivLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:layout_marginTop="20dp"
/>
<ImageView
android:id="@+id/ivAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="110dp"
android:layout_centerHorizontal="true"
android:focusable="true"
/>
There is some overlapping between the images .
The Action image overlaps with the logo.
This is expected behaviour as they both have some common space on the screen.
The top part of action image comes on top of the logo while i want the bottom part of the logo to come over the top of action image .
What is happening - Action is on top
--
what is required -- Action should go to the background
I will appreciate any help.
Upvotes: 1
Views: 899
Reputation: 1702
Try this. This will place your top image at the center of your background image
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<ImageView
android:id="@+id/ivLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:layout_marginTop="20dp"
/>
<ImageView
android:id="@+id/ivAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="110dp"
android:layout_centerInParent="true"
android:focusable="true"
/>
</RelativeLayout>
Upvotes: 0
Reputation: 6319
Just change the order of your 2 ImageViews in your XML. The system draws them in the same order, so whatever you put first comes on bottom.
Upvotes: 1