danmacleod
Newbie
I have a RecyclerView that I want to fill the remaining space of a screen. However, if I set the width to "wrap_content" the last few rows of the RecyclerView are not shown. It seems the RecyclerView is not calculating its height properly. Looks like others have similar issues but I haven't been able to find a fix. Any ideas?
This is the layout for each data row used by the adapter
Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/constraint_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/title_txt"
style="@style/Headers"
android:layout_width="314dp"
android:layout_height="32dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="@string/checklist"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.492"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/clear_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:text="@string/clear"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title_txt" />
<!--android:layout_height="340dp"-->
<android.support.v7.widget.RecyclerView
android:id="@+id/drag_list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/clear_btn"/>
</android.support.constraint.ConstraintLayout>
This is the layout for each data row used by the adapter
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Used to display items in a list.-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:id="@+id/left_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp"
android:layout_gravity="start"
android:contentDescription="@string/empty_image"/>
<TextView
android:id="@+id/text"
style="@style/Lists"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLength="25"
android:layout_gravity="center_horizontal"
/>
<ImageView
android:id="@+id/right_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginEnd="8dp"
android:layout_marginStart="16dp"
android:contentDescription="@string/empty_image" />
</LinearLayout>