Android-ItemTouchHelper-Demo
Android-ItemTouchHelper-Demo copied to clipboard
Dragging jumps several rows when padding is set on RecyclerView
Use this layout to see this issue then try and drag the last item in the list/grid upwards to see it jump several positions:
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:paddingBottom="150dp"
android:paddingTop="150dp" />
@timothyjc I too am seeing this issue. My code is shown below:
<android.support.v7.widget.RecyclerView
android:id="@+id/songs_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="16dp"/>
The last item creates a weird situation. I hope @iPaulPro fixes it soon. Thank you so much.
Any news on this?
It happens when the paddingTop is set to more than 0dp. Has anyone found a workaround/fix?
Well. Instead of setting the top and bottom paddings, you can create a special type of a ViewHolder to mimic paddings, then disable its movement. Here you can find how to implement this: https://github.com/iPaulPro/Android-ItemTouchHelper-Demo/issues/4