I have a recyclerview item that is a frameLayout with an ImageView and a TextView over it. I have set the xml values but inside the onBindViewHolder i do some actions and set the values to the views
The layout is like bleow
<FrameLayout
android:id="@+id/img_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/message_received_item"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.package.views.RoundedImageView
android:id="@+id/img_rcv_msg_image"
android:layout_width="210dp"
android:layout_height="210dp"
android:adjustViewBounds="true"
android:elevation="8dp"
android:maxWidth="320dp"
android:maxHeight="320dp"
android:minWidth="150dp"
android:minHeight="150dp"
android:scaleType="centerCrop"
app:bottomRightCorner="20dp"
app:topLeftCorner="20dp"
app:srcCompat="@android:drawable/ic_menu_report_image"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/img_rcvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|start"
android:layout_margin="8dp"
android:text="Unknown"
android:textColor="#f00"
android:textSize="12sp" />
<TextView
android:id="@+id/img_rcv_msg_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="8dp"
android:text="--:--"
android:textColor="#f00"
android:textSize="10sp"
android:textStyle="italic" />
</FrameLayout>
At the layout Design preview of the Android Studio i can correctly see the TextViews ABOVE the ImageView (which is custom but no worries). However in the onBind of the RecyclerView i calculate my values and when i set the Bitmap to the ImageView and the text to the TextViews the TextViews are not shown at all. I suppose the hide behind the ImageView. Does anyone know why?
The first assumption is that your RoundedImageView is above the text (due to the elevation attribute). Remove elevation from ImageView or set TextView to greater than 8