Created
February 9, 2021 12:01
-
-
Save robertlevonyan/2bbaa8ee1bd03ac72dd8d2455298f6b7 to your computer and use it in GitHub Desktop.
start drag on long click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
itemView.setOnLongClickListener { view -> | |
val data = ClipData.newPlainText("", word) | |
val shadowBuilder = View.DragShadowBuilder(view) | |
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { | |
view.startDragAndDrop(data, shadowBuilder, view, 0) | |
} else { | |
view.startDrag(data, shadowBuilder, view, 0) | |
} | |
true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment