Search code examples
androidandroid-listview

android listView clipping and unable to scroll


I've a fragment file with a listview in it, as my number of items increase, they are populating beyond the screen but I'm unable to scroll the listView to bring the hidden items up. Most of the tutorials are following LinearLayout etc. but I want to stay within the modern constrain layout mode.

<?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:layout_width="match_parent"
    android:layout_height="match_parent">

    <ListView
        android:id="@+id/userList"
        android:layout_width="409dp"
        android:layout_height="729dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

Solution

  • There is a similar question HERE where the poster indicated it was working fine all along, but needed more elements to scroll.

    If that is not the case, try setting this in your ListView

    android:layout_height="0dp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    

    I haven't tested it, but some people reported success so give it a try.