Android

Android Tips ScrollView嵌套RecyclerView出現數據不全

android.support.v4.widget.NestedScrollView代替ScrollView

RecyclerView添加属性android:nestedScrollingEnabled=”false”

 <android.support.v4.widget.NestedScrollView
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <android.support.v7.widget.RecyclerView
                android:nestedScrollingEnabled="false"
                android:id="@+id/successful_authentication"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginStart="8dp"
                android:layout_marginTop="24dp"
                android:layout_marginEnd="8dp"
                android:layout_marginBottom="32dp"
                android:background="@drawable/complete_bg"
                android:elevation="5dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/complete_registration" />

            <android.support.v7.widget.RecyclerView
                android:nestedScrollingEnabled="false"
                android:id="@+id/complete_registration"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginStart="8dp"
                android:layout_marginTop="32dp"
                android:layout_marginEnd="8dp"
                android:background="@drawable/complete_bg"
                android:elevation="5dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

            </android.support.v7.widget.RecyclerView>
        </android.support.constraint.ConstraintLayout>
    </android.support.v4.widget.NestedScrollView>

發表迴響