I am creating screen which consists of list of items. Each item consists of 2 ImageViews, one overlapping over another. One is icon and the other is image. We see both of them, but image covers bottom right part of icon.
Not a problem to achieve this, but would like to know what is the standard/best solution in android world nowadays for this case. Android recommends using constraintLayout almost wherever you can and all the other things like Relativelayout fall in shadow.
In this case before asking question, I planned to use negative margins in my constraintLaout to set image ove the icon:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/orderNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/ic_star_big"/>
<ImageView
android:layout_width="130dp"
android:layout_height="200dp"
app:layout_constraintLeft_toRightOf="@id/orderNumber"
app:layout_constraintTop_toBottomOf="@id/orderNumber"
android:src="@color/black"
android:layout_marginTop="-10dp"
android:layout_marginStart="-15dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Is this best way, does it have downfalls? Is there better way to achieve this?