Home > Net >  My listview seems to hide the bottom two entries once the entire page is full
My listview seems to hide the bottom two entries once the entire page is full

Time:02-01

I have a list view with a list view adapter in my kotlin project. It works perfectly fine for the first thirteen entries, once I go past that the next two entries don't show up however for every entry after those next two the entry I entered two entries before shows up and I can scroll to it (So if I put in a sixteenth entry then the fourteenth will show up). When deleting so that the whole page is no longer full the final two show up. When debugging I saw that they should be visible as the list view adapter shows the code to display them running so I think the problem is that when scrolling the listview I just cant scroll till the bottom 2. Due to this I suspect that the navigation bar is maybe covering the bottom two entries or that the list view for some reason is longer than or as long as the parent so the bottom of it is past the end of the page. However I am still not sure how to fix this problem even though I think I know what it is. The xml code for the list is below:

<ListView
    android:id="@ id/listview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@ id/header" />

CodePudding user response:

Can you try to change your constraint for ListView like this

<ListView
    android:id="@ id/listview"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintTop_toBottomOf="@ id/header" />

here i have consider that there is not other view below listview to show that's why i have set bottom constraint to parent

  • Related