mardi 1 décembre 2020

recyclerview in scrollview won't inflate

I have issue that when I check an item using checkbox for 1 item in my list It's checking automatically another item from the list together with the one that I choose.

After consulting with some guys they told me that its related to the size of the list. I have 30 items in my list and after scrolling 10 items in my list, The position is reset.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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="wrap_content"
    android:layout_height="wrap_content"
    android:fillViewport="true">

<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"
    android:orientation="vertical"
    tools:context=".Activities.Gameslist">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="58dp"
        android:text="List of Games"
        android:textColor="@color/BlackColor"
        android:textSize="25dp"
        android:textStyle="bold"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/submit"
        android:layout_width="410dp"
        android:layout_height="30dp"
        android:background="@color/LightBlue"
        android:text="Add to my games"
        android:textColor="@color/WhiteColor"
        app:layout_constraintTop_toBottomOf="@+id/textView"
        tools:layout_editor_absoluteX="0dp" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="393dp"
        android:layout_height="566dp"
        android:layout_marginTop="8dp"
        app:layout_constraintTop_toBottomOf="@+id/submit"
        tools:layout_editor_absoluteX="2dp">

    </androidx.recyclerview.widget.RecyclerView>

</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>



Aucun commentaire:

Enregistrer un commentaire