DragAndDrop

  
Accept drag-and-drop data from another app or within an app, and show a consistent drop target affordance.
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
December 15, 2021 - - - 1.0.0-alpha02

Declaring dependencies

To add a dependency on CardView, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

Groovy

dependencies {
    implementation "androidx.draganddrop:draganddrop:1.0.0-alpha02"
}

Kotlin

dependencies {
    implementation("androidx.draganddrop:draganddrop:1.0.0-alpha02")
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.0

Version 1.0.0-alpha02

December 15, 2021

androidx.draganddrop:draganddrop:1.0.0-alpha02 is released. Version 1.0.0-alpha02 contains these commits.

Features in initial release

DropHelper, the first member of the draganddrop library, is a utility class that simplifies implementation of drag and drop capabilities. Use DropHelper to specify drop targets, customize drop target highlighting, and define how dropped data is handled.

DropHelper leverages Jetpack’s OnReceiveContentListener to provide target-specific processing of drag and drop ClipData. DropHelper enhances the user experience by configuring drop targets to display a highlight as users drag content over the targets. The DropHelper.Options nested class enables you to customize the color and corner radius of the default highlight.

DropHelper.Options also gives you the ability to list all EditText elements contained in the view hierarchy of complex drop targets. DropHelper prevents the EditText elements from stealing focus from the drop target when users drag data over the target. If the drag and drop ClipData includes text and URI data, DropHelper selects one of the EditText elements in the drop target to handle the text data when the ClipData is dropped.

For more information, see the Drag and drop developer’s guide.