使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
photopicker
此库为嵌入式照片选择器提供了 Compose 和 Android View 集成。
声明依赖项
如需添加 PhotoPicker 的依赖项,您必须将 Google Maven 制品库添加到项目中。如需了解详情,请参阅 Google 的 Maven 代码库。
在应用或模块的 build.gradle
文件中添加所需工件的依赖项:
Groovy
dependencies {
// For apps using Compose
implementation "androidx.photopicker:photopicker-compose:1.0.0-alpha01"
// For apps using Android views
implementation "androidx.photopicker:photopicker:1.0.0-alpha01"
}
Kotlin
dependencies {
// For apps using Compose
implementation("androidx.photopicker:photopicker-compose:1.0.0-alpha01")
// For apps using Android views
implementation("androidx.photopicker:photopicker:1.0.0-alpha01")
}
如需详细了解依赖项,请参阅添加 build 依赖项。
反馈
您的反馈将帮助我们改进 Jetpack。如果您发现了新问题,或对此库有任何改进建议,请告诉我们。创建新问题前,请先查看此库中的现有问题。您可以点击星标按钮,为现有问题投票。
创建新问题
如需了解详情,请参阅问题跟踪器文档。
此工件没有版本说明。
版本 1.0
版本 1.0.0-alpha01
2025 年 6 月 4 日
发布了 androidx.photopicker:photopicker:1.0.0-alpha01
、androidx.photopicker:photopicker-compose:1.0.0-alpha01
和 androidx.photopicker:photopicker-testing:1.0.0-alpha01
。版本 1.0.0-alpha01 包含这些提交内容。
新功能
- 嵌入式照片选择器的 androidx 实现的初始 Alpha 版,可让基于 View 和基于 Compose 的应用轻松与嵌入式照片选择器服务集成。
API 变更
- 添加了
EmbeddedPhotopicker
可组合项,以用作基于 Compose 的应用的入口点。
- 可以使用
rememberEmbeddedPhotoPickerState
(推荐),也可以使用 EmbeddedPhotoPickerState
接口实现自己的状态管理。
- 添加了
EmbeddedPhotopickerView
作为基于 View 的应用的入口点。
EmbeddedPhotoPickerStateChangeListener
可用于接收与 PhotoPicker 中状态相关的回调。
- 添加了
TestEmbeddedPhotoPickerProvider
,以允许应用测试依赖于嵌入式照片选择器的流程。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# photopicker\n===========\n\nAPI Reference \n[androidx.photopicker](/reference/kotlin/androidx/photopicker/package-summary) \nThis library provides an integration for Compose and Android Views for the embedded photo picker. \n\n| Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |\n|---------------|----------------|-------------------|--------------|-----------------------------------------------------------------------|\n| June 4, 2025 | - | - | - | [1.0.0-alpha01](/jetpack/androidx/releases/photopicker#1.0.0-alpha01) |\n\nDeclaring dependencies\n----------------------\n\nTo add a dependency on PhotoPicker, 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 // For apps using Compose\n implementation \"androidx.photopicker:photopicker-compose:1.0.0-alpha01\"\n // For apps using Android views\n implementation \"androidx.photopicker:photopicker:1.0.0-alpha01\"\n}\n \n```\n\n### Kotlin\n\n```kotlin\ndependencies {\n // For apps using Compose\n implementation(\"androidx.photopicker:photopicker-compose:1.0.0-alpha01\")\n // For apps using Android views\n implementation(\"androidx.photopicker:photopicker:1.0.0-alpha01\")\n}\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:1815792%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=1815792&template=2142352)\n\nSee the [Issue Tracker documentation](https://developers.google.com/issue-tracker)\nfor more information.\n\nThere are no release notes for this artifact.\n\nVersion 1.0\n-----------\n\n### Version 1.0.0-alpha01\n\nJune 4, 2025\n\n`androidx.photopicker:photopicker:1.0.0-alpha01`, `androidx.photopicker:photopicker-compose:1.0.0-alpha01`, and `androidx.photopicker:photopicker-testing:1.0.0-alpha01` are released. Version 1.0.0-alpha01 contains [these commits](https://android.googlesource.com/platform/frameworks/support/+log/786176dc2284c87a0e620477608e0aca9adeff15/photopicker).\n\n**New Features**\n\n- The initial alpha release of androidx implementations of the [Embedded PhotoPicker](https://developer.android.com/reference/android/widget/photopicker/package-summary) that enable both View based and Compose based applications to easily integrate with the Embedded Photopicker service.\n\n**API Changes**\n\n- Added `EmbeddedPhotopicker` composable for as an entrypoint for compose based applications.\n - `rememberEmbeddedPhotoPickerState` can be used (recommended) or applications can implement their own state management with the `EmbeddedPhotoPickerState` interface.\n- Added `EmbeddedPhotopickerView` as an entrypoint for view based applications.\n - `EmbeddedPhotoPickerStateChangeListener` can be used to receive related callbacks to state inside the PhotoPicker.\n- Added `TestEmbeddedPhotoPickerProvider` to allow apps to test flows that rely on the Embedded Photopicker."]]