Khi tôi đặt RecyclerView
bên NestedScrollView
sau đó onBindViewHolder
đang kêu gọi tất cả các hàng như nói rằng tôi có danh sách trong đó có kích thước là 30 sau đó onBindViewHolder
được gọi cho tất cả 30 hàng cùng một lúc ngay cả khi không di chuyểnRecyclerView bên NestedScrollView onBindViewHolder kêu gọi tất cả các kích thước getItemCount
RecyclerView list;
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
list.setLayoutManager(layoutManager);
layoutManager.setAutoMeasureEnabled(true);
list.setNestedScrollingEnabled(false);
list.addItemDecoration(new VerticalSpaceItemDecoration(5));
list.setAdapter(adapter);
xml của tôi là
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_views"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/info"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textAlignment="center"
android:visibility="visible"
/>
nhưng nếu tôi xóa NestedScrollView
nó hoạt động bình thường.
Bạn có tìm thấy giải pháp nào cho vấn đề này không, Điều này chắc chắn liên quan đến RecylerView bên trong NestedScrollView –