I’ve been searching for anything I can find on drag listeners, but all I found was the android studio guide which further confused me.
I’m trying to get this to work dashboard.setOnDragListener()
(dashboard is just a cardview), but I’m confused by the parameters it needs, the error I get: No value passed for parameter ‘l’
I think the documentation mentioned 2 more parameters, but I’m lost
If I can get better help than what I got from the documentation I’ll be a happy man
MainActivity.kt:
var dashboard = findViewById<View>(R.id.dashboard)
2
Answers
Remember that the target view that receives drag-and-drops gets the drag listener. The views that will be dragged get a call to startDragAndDrop.
Here’s what mine looks like:
Then for the views that are getting dragged, register them for the dragging operation like this.
Oh right, I almost forgot. Pass your draglistener to the target.