What I want to achieve: I want to have a view inside a scrollable layout (Recyclerview
with GridlayoutManager
) with tiles (Views) in it. Dragging and dropping an item inside of the RecyclerView
should adjust the position of the icon and swap with the other elements. When a drag starts, an icon above the RecyclerView
will change to a trash icon and dragging the view to this icon will delete it from this RecyclerView
.
I tried this excellent tutorial, but I didn't find a way how to handle dragging outside of the Recyclerview
as the ItemTouchHelper.Callback
uses only Recycler.ViewHolder
elements as possible targets.
The method interpolateOutOfBoundsScroll()
gives feedback if the view moves out of the boundaries, but will only give back the total size that is offscreen, but no coordinates. Also, trying to drag the view out of the Recyclerview
always results in cutting of the View where it passes the borders of the Recyclerview
.
Does anyone have an idea how I could achieve this effect?
RelativeLayout
that contains someTextviews
,Imageviews
and also theImageview
which should turn into a trash bin. I like your idea with the sticky header. If the trashImageview
is the only element in the sticky header and doesn't fill it completely, is there a way to prevent users from dragging the views to the positions next to the trashImageview
row? I will try this out right now – Gilbertogilbertson