I have an imageview and I want to place a button for closing/deleting the image from the imageView just like it's done on Tinder profile pics. The problem is that it's always placed behind it not matter what I do.
I have a RelativeLayout as container for the imageview and imagebutton
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageButton
android:id="@+id/close1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_close"
android:background="@color/white"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" />
<ImageView
android:id="@+id/photo1"
android:layout_width="match_parent"
android:layout_height="115dp"
android:layout_marginHorizontal="5dp"
android:background="@drawable/rounded_rect_primary"
android:elevation="5dp"
android:scaleType="fitXY"
android:src="@drawable/icon_upload" />
</RelativeLayout>
I've tried something like this too:
close1.bringToFront();
close2.bringToFront();
close3.bringToFront();
I'd like to understand how it works, what exactly defines what comes in front and behind?