컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
DragAndDrop
다른 앱 또는 앱 내에서 드래그 앤 드롭 데이터를 허용하고 일관된 드롭 타겟 어포던스를 표시합니다.
최근 업데이트 |
안정화 버전 |
출시 후보 버전 |
베타 버전 |
알파 버전 |
2022년 5월 11일 |
1.0.0 |
- |
- |
- |
종속 항목 선언
DragAndDrop의 종속 항목을 추가하려면 프로젝트에 Google Maven 저장소를 추가해야 합니다. 자세한 내용은 Google Maven 저장소를 읽어보세요.
다음과 같이 앱 또는 모듈의 build.gradle
파일에 필요한 아티팩트의 종속 항목을 추가합니다.
Groovy
dependencies {
implementation "androidx.draganddrop:draganddrop:1.0.0"
}
Kotlin
dependencies {
implementation("androidx.draganddrop:draganddrop:1.0.0")
}
종속 항목에 관한 자세한 내용은 빌드 종속 항목 추가를 참고하세요.
의견
제출하신 의견은 Jetpack을 개선하는 데 도움이 됩니다. 새로운 문제를 발견하거나 라이브러리 개선을 위한 아이디어가 있다면 Google에 알려 주세요. 새 문제를 제출하기 전에 이 라이브러리의 기존 문제를 살펴보시기 바랍니다. 별표 버튼을 클릭하여 기존 문제에 투표할 수 있습니다.
새로운 문제 제출하기
자세한 내용은 Issue Tracker 문서를 참고하세요.
버전 1.0
버전 1.0.0
2022년 5월 11일
androidx.draganddrop:draganddrop:1.0.0
이 출시되었습니다. 버전 1.0.0에 포함된 커밋을 확인하세요.
1.0.0의 주요 기능
draganddrop
라이브러리의 첫 번째 구성요소인 DropHelper
는 드래그 앤 드롭 기능의 구현을 간소화하는 유틸리티 클래스입니다. DropHelper
를 사용하면 드롭 타겟을 지정하고 드롭 타겟 강조표시를 맞춤설정하며 드롭된 데이터의 처리 방법을 정의할 수 있습니다.
DropHelper
는 Jetpack의 OnReceiveContentListener
를 활용하여 드래그 및 드롭 ClipData
를 타겟별로 처리합니다. DropHelper
는 사용자가 타겟 위로 콘텐츠를 드래그할 때 강조표시되도록 드롭 타겟을 구성하여 사용자 환경을 향상합니다. DropHelper.Options
중첩 클래스를 사용하면 기본 강조표시의 모양을 맞춤설정할 수 있습니다.
DropHelper
는 타겟을 드롭하는 OnReceiveContentListener
를 추가하고 드롭 타겟이 드래그 앤 드롭 이벤트를 수신 대기하도록 구성합니다. DropHelper
를 사용할 때 타겟을 드롭하기 위해 OnDragListener
또는 추가적인 OnReceiveContentListener
를 추가하지 마세요.
DropHelper.Options
는 복잡한 드롭 타겟의 뷰 계층 구조에 포함된 모든 EditText
요소를 나열할 수 있습니다. 이러한 요소가 있으면 이 방식으로 지정해야 합니다. DropHelper
는 사용자가 타겟 위로 데이터를 드래그할 때 드롭 타겟에 있는 포커스가 EditText
요소로 바뀌지 않도록 방지합니다. 드래그 앤 드롭 ClipData
에 텍스트와 URI 데이터가 포함된 경우 DropHelper
는 ClipData
가 드롭될 때 텍스트 데이터를 처리할 드롭 타겟의 EditText
요소 중 하나를 선택합니다.
자세한 내용은 드래그 앤 드롭 개발자 가이드를 참고하세요.
버전 1.0.0-rc01
2022년 4월 20일
androidx.draganddrop:draganddrop:1.0.0-rc01
이 출시되었습니다. 버전 1.0.0-rc01에 포함된 커밋을 확인하세요.
버전 1.0.0-beta01
2022년 3월 23일
androidx.draganddrop:draganddrop:1.0.0-beta01
이 출시되었습니다. 버전 1.0.0-beta01에 포함된 커밋을 확인하세요.
버전 1.0.0-alpha04
2022년 2월 23일
androidx.draganddrop:draganddrop:1.0.0-alpha04
가 출시되었습니다. 버전 1.0.0-alpha04에 포함된 커밋을 확인하세요.
API 변경사항
- null이 아닌 localState가 있는 DragEvents는 기본적으로 강조표시를 트리거하지 않습니다. 이 동작을 변경할 수 있는 구성 옵션이 있습니다. (I55792)
버전 1.0.0-alpha03
2022년 1월 26일
androidx.draganddrop:draganddrop:1.0.0-alpha03
이 출시되었습니다. 버전 1.0.0-alpha03에 포함된 커밋을 확인하세요.
새로운 기능
- Android S 이상을 실행하는 기기에서 이제
DropHelper
가 OnReceiveContentListener
의 시스템 구현에 위임하여 드래그 앤 드롭 이외의 입력 방법을 자동으로 지원합니다.
버전 1.0.0-alpha02
2021년 12월 15일
androidx.draganddrop:draganddrop:1.0.0-alpha02
가 출시되었습니다. 버전 1.0.0-alpha02에 포함된 커밋을 확인하세요.
최초 출시의 기능
draganddrop
라이브러리의 첫 번째 구성요소인 DropHelper
는 드래그 앤 드롭 기능의 구현을 간소화하는 유틸리티 클래스입니다. DropHelper
를 사용하면 드롭 타겟을 지정하고 드롭 타겟 강조표시를 맞춤설정하며 드롭된 데이터의 처리 방법을 정의할 수 있습니다.
DropHelper
는 Jetpack의 OnReceiveContentListener
를 활용하여 드래그 및 드롭 ClipData
를 타겟별로 처리합니다. DropHelper
는 사용자가 타겟 위로 콘텐츠를 드래그할 때 강조표시되도록 드롭 타겟을 구성하여 사용자 환경을 향상합니다. DropHelper.Options
중첩 클래스를 사용하면 기본 강조표시의 색상과 모서리 반지름을 맞춤설정할 수 있습니다.
또한 DropHelper.Options
는 복잡한 드롭 타겟의 뷰 계층 구조에 포함된 모든 EditText
요소를 나열할 수 있습니다. DropHelper
는 사용자가 타겟 위로 데이터를 드래그할 때 드롭 타겟에 있는 포커스가 EditText
요소로 바뀌지 않도록 방지합니다. 드래그 앤 드롭 ClipData
에 텍스트와 URI 데이터가 포함된 경우 DropHelper
는 ClipData
가 드롭될 때 텍스트 데이터를 처리할 드롭 타겟의 EditText
요소 중 하나를 선택합니다.
자세한 내용은 드래그 앤 드롭 개발자 가이드를 참고하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# DragAndDrop\n===========\n\nAPI Reference \n[androidx.draganddrop](/reference/kotlin/androidx/draganddrop/package-summary) \nAccept drag-and-drop data from another app or within an app, and show a consistent drop target affordance. \n\n| Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |\n|---------------|-------------------------------------------------------|-------------------|--------------|---------------|\n| May 11, 2022 | [1.0.0](/jetpack/androidx/releases/draganddrop#1.0.0) | - | - | - |\n\nDeclaring dependencies\n----------------------\n\nTo add a dependency on DragAndDrop, you must add the Google Maven repository to your\nproject. Read [Google's Maven repository](/studio/build/dependencies#google-maven)\nfor more information.\n\nAdd the dependencies for the artifacts you need in the `build.gradle` file for\nyour app or module: \n\n### Groovy\n\n```groovy\ndependencies {\n implementation \"androidx.draganddrop:draganddrop:1.0.0\"\n}\n```\n\n### Kotlin\n\n```kotlin\ndependencies {\n implementation(\"androidx.draganddrop:draganddrop:1.0.0\")\n}\n```\n\nFor more information about dependencies, see [Add build dependencies](/studio/build/dependencies).\n\nFeedback\n--------\n\nYour feedback helps make Jetpack better. Let us know if you discover new issues or have\nideas for improving this library. Please take a look at the\n[existing issues](https://issuetracker.google.com/issues?q=componentid:1139019%20status:open)\nin this library before you create a new one. You can add your vote to an existing issue by\nclicking the star button.\n\n[Create a new issue](https://issuetracker.google.com/issues/new?component=1139019&template=1644483)\n\nSee the [Issue Tracker documentation](https://developers.google.com/issue-tracker)\nfor more information.\n\nVersion 1.0\n-----------\n\n### Version 1.0.0\n\nMay 11, 2022\n\n`androidx.draganddrop:draganddrop:1.0.0` is released. [Version 1.0.0 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/792d15289c94ffb5121f8e0ea664cc758926ff49..50f2d1d62c4cb89366df3bf9f811754b8cdda677/draganddrop/draganddrop)\n\n**Major features of 1.0.0**\n\n`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.\n\n- `DropHelper` leverages Jetpack's [`OnReceiveContentListener`](/reference/androidx/core/view/OnReceiveContentListener) to provide target-specific processing of drag and drop [`ClipData`](/reference/android/content/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 appearance of the default highlight.\n- `DropHelper` attaches an [`OnReceiveContentListener`](/reference/androidx/core/view/OnReceiveContentListener) to drop targets and configures drop targets to listen for drag and drop events. Do not attach an [`OnDragListener`](/jetpack/androidx/releases/m/reference/android/view/View.OnDragListener) or additional `OnReceiveContentListener` to drop targets when using `DropHelper`.\n- `DropHelper.Options` gives you the ability to list all [`EditText`](/reference/android/widget/EditText) elements contained in the view hierarchy of complex drop targets. If any are present, they must be specified in this way. `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.\n\nFor more information, see the [Drag and drop](/guide/topics/ui/drag-drop#drophelper) developer's guide.\n\n### Version 1.0.0-rc01\n\nApril 20, 2022\n\n`androidx.draganddrop:draganddrop:1.0.0-rc01` is released. [Version 1.0.0-rc01 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/5ef5671233460b844828e14a816255dbf7904868..792d15289c94ffb5121f8e0ea664cc758926ff49/draganddrop/draganddrop)\n\n- No changes since the last beta release.\n\n### Version 1.0.0-beta01\n\nMarch 23, 2022\n\n`androidx.draganddrop:draganddrop:1.0.0-beta01` is released. [Version 1.0.0-beta01 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/9b2b3d8efd5f00bd4af903bbaa926f6a712d0bd8..5ef5671233460b844828e14a816255dbf7904868/draganddrop/draganddrop)\n\n- No changes since last alpha release.\n\n### Version 1.0.0-alpha04\n\nFebruary 23, 2022\n\n`androidx.draganddrop:draganddrop:1.0.0-alpha04` is released. [Version 1.0.0-alpha04 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/9dceceb54300ed028a7e8fc7a3454f270337ffde..9b2b3d8efd5f00bd4af903bbaa926f6a712d0bd8/draganddrop/draganddrop)\n\n**API Changes**\n\n- DragEvents with a non-null localState will not trigger highlighting by default. There is a configuration option to change this behavior. ([I55792](https://android-review.googlesource.com/#/q/I55792b436b346ed9e5fa092c88b4e878087d1395))\n\n### Version 1.0.0-alpha03\n\nJanuary 26, 2022\n\n`androidx.draganddrop:draganddrop:1.0.0-alpha03` is released. [Version 1.0.0-alpha03 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/301586664b5aad60548f21866cad502d524dbf9f..9dceceb54300ed028a7e8fc7a3454f270337ffde/draganddrop/draganddrop)\n\n**New Features**\n\n- On devices running Android S or later, `DropHelper` now delegates to the system implementation of `OnReceiveContentListener`, automatically providing support for input methods other than drag and drop.\n\n### Version 1.0.0-alpha02\n\nDecember 15, 2021\n\n`androidx.draganddrop:draganddrop:1.0.0-alpha02` is released. [Version 1.0.0-alpha02 contains these commits.](https://android.googlesource.com/platform/frameworks/support/+log/301586664b5aad60548f21866cad502d524dbf9f/draganddrop/draganddrop)\n\n**Features in initial release**\n\n`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.\n\n`DropHelper` leverages Jetpack's [`OnReceiveContentListener`](/reference/androidx/core/view/OnReceiveContentListener) to provide target-specific processing of drag and drop [`ClipData`](https://developer.android.com/reference/android/content/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.\n\n`DropHelper.Options` also gives you the ability to list all [`EditText`](/reference/android/widget/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.\n\nFor more information, see the [Drag and drop](/guide/topics/ui/drag-drop) developer's guide."]]