1

I have this recyclerview in which I have an arrow at the end of it but the thing is, even though I have setup the constraints for the arrow to appear After the recyclerview, it keeps appearing on top of it. How can I fix this?

enter image description here

This is the layout:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   tools:context=".ui.home.HomeActivity">

   <androidx.constraintlayout.widget.Guideline
       android:id="@+id/gl_50"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:orientation="horizontal"
       app:layout_constraintGuide_percent="0.5" />

   <androidx.constraintlayout.widget.Guideline
       android:id="@+id/gl_75"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:orientation="horizontal"
       app:layout_constraintGuide_percent="0.75" />

   <TextView
       android:id="@+id/tv_news_title"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="@string/news_main_title"
       android:textAppearance="?android:attr/textAppearanceLarge"
       android:textColor="@color/black"
       app:layout_constraintBottom_toTopOf="@+id/rv_news"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintStart_toStartOf="parent" />

   <androidx.recyclerview.widget.RecyclerView
       android:id="@+id/rv_news"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginStart="16dp"
       android:layout_marginEnd="16dp"
       app:layout_constraintBottom_toTopOf="@+id/gl_75"
       app:layout_constraintStart_toStartOf="parent"
       app:layout_constraintEnd_toStartOf="@id/ibtn_arrow"/>

   <ImageButton
       android:id="@+id/ibtn_arrow"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:background="@drawable/ic_baseline_arrow_forward"
       app:layout_constraintBottom_toTopOf="@+id/gl_75"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintTop_toTopOf="@+id/gl_50" />

</androidx.constraintlayout.widget.ConstraintLayout>
dazai
  • 766
  • 4
  • 25
  • RecyclerView width should be 0dp so it respects the constraint. You have it as `match_parent` so it's ignoring the constraint. – Tenfour04 Sep 07 '21 at 19:55

0 Answers0