透過集合功能整理內容
你可以依據偏好儲存及分類內容。
photopicker
這個程式庫可為內嵌相片挑選器提供 Compose 和 Android 檢視畫面的整合功能。
宣告依附元件
如要為 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")
}
如要進一步瞭解依附元件,請參閱「新增建構依附元件」一文。
意見回饋
您的意見可協助我們改善 Jetpack。如果您發現新問題,或是有改進這個程式庫的建議,請告訴我們。回報新問題前,請先查看這個程式庫的現有問題。只要按一下星號按鈕,即可投票給現有的問題。
建立新問題
詳情請參閱 Issue Tracker 文件。
這個構件沒有任何版本資訊。
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 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[null,null,["上次更新時間: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."]]