Nephilim
Nephilim

Reputation: 524

RecyclerView doesnt scroll down all the way if there are many items

Right now I'm using a simple RecyclerView that's supposed to be showing up under a TextView. However when I populate the RecyclerView with more items, it gets cut off and wont scroll down. What I remember from RecyclerViews is that every implementation I've done basically worked out of the box when it comes to scrolling.

<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="david.projectclouds.MainActivity"
tools:showIn="@layout/app_bar_main">


<TextView
    android:id="@+id/Date"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/_20sdp"
    android:paddingLeft="@dimen/_20sdp"
    android:paddingTop="@dimen/_20sdp"
    android:textAllCaps="true"
    android:textColorLink="@color/colorAccent"
    android:textSize="30sp"
    android:typeface="sans"
 />

<android.support.v7.widget.RecyclerView
    android:id="@+id/recycler_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintTop_toBottomOf="@+id/Date"

    android:scrollbars="vertical"
 />
</android.support.constraint.ConstraintLayout>

This is my current main activity XML. Tell me if I need to add more code.

Upvotes: 0

Views: 143

Answers (1)

Milos Lulic
Milos Lulic

Reputation: 627

Try to use constraints

<android.support.v7.widget.RecyclerView
    android:id="@+id/recycler_view"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_marginBottom="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginTop="8dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/Date"
    android:layout_marginStart="8dp"
    android:layout_marginEnd="8dp" />

Upvotes: 2

Related Questions