I have a view(Calendar) that contains multiple Rects(Events) drawn on it, now I am trying to implement drag/drop as another layer on top of that view. Example- I long-press on an event, it passes me the exact coordinates of the Rect(Event), no I have created a custom view which will draw the same Rect(because I have coordinates)
class DraggerView: View {
constructor(context: Context) : this(context, null)
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
override fun isInEditMode(): Boolean {
return true
}
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
}
}
Now the listener will pass me the coordinates when long-press on an event.
Current situation: I put the above view in the XML(On Top of the calendar View) and just made it visible when I get the coordinates, but don't know how to draw Rect on it because it is already initialized.
If I miss something to provide as information, please let me know in the comments I'll update the question
I have created a custom view which will draw the event on the same coordinates and can move that event