Media3 UI 模組
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
播放媒體的應用程式需要使用者介面元件,才能顯示媒體和控制播放。Media3 程式庫包含兩個 UI 模組,內含許多 UI 元件。
如要使用以 Views 為基礎的 UI 模組,請新增下列依附元件:
Kotlin
implementation("androidx.media3:media3-ui:1.8.0")
Groovy
implementation "androidx.media3:media3-ui:1.8.0"
如要依附 以 Jetpack Compose 為基礎的 UI 模組,請新增下列依附元件:
Kotlin
implementation("androidx.media3:media3-ui-compose:1.8.0")
Groovy
implementation "androidx.media3:media3-ui-compose:1.8.0"
強烈建議您以 Compose 為優先開發應用程式,或從使用 Views 遷移。
注意:media3-ui-compose
模組尚未與 media3-ui
模組達到同等程度。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[[["容易理解","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-08-27 (世界標準時間)。"],[],[],null,["An app playing media requires user interface components for displaying media and\ncontrolling playback. The Media3 library includes two UI modules that contain a\nnumber of UI components.\n\nTo use the [Views-based UI module](/media/media3/ui/playerview), add the following dependency: \n\nKotlin \n\n```kotlin\nimplementation(\"androidx.media3:media3-ui:1.8.0\")\n```\n\nGroovy \n\n```groovy\nimplementation \"androidx.media3:media3-ui:1.8.0\"\n```\n\nTo depend on the [Jetpack Compose-based UI module](/media/media3/ui/compose), add the following\ndependency: \n\nKotlin \n\n```kotlin\nimplementation(\"androidx.media3:media3-ui-compose:1.8.0\")\n```\n\nGroovy \n\n```groovy\nimplementation \"androidx.media3:media3-ui-compose:1.8.0\"\n```\n\nWe highly encourage you to develop your app in a Compose-first fashion or\n[migrate from using Views](/develop/ui/compose/migrate).\n\n**Note:** The `media3-ui-compose` module is not yet at parity with the\n`media3-ui` module."]]