Recyclerview automatically slides after loading

When using a recyclerView in a layout, open the page for the first time - load data - display the list. At this time, recyclerView will automatically slide down for a while. This is because the recyclerview gets the focus. Adding android:descendantFocusability="blocksDescendants" in the parent layout can be solved

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:descendantFocusability="blocksDescendants">
    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
</RelativeLayout>
 

Guess you like

Origin blog.csdn.net/cao2884388/article/details/121495917
Recommended