Compose for TV に移行する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Leanback UI ツールキットから Android TV 向け Compose に移行する手順は次のとおりです。
使用しているコンポーネント(事前作成されたフラグメント内にあるコンポーネントを含む)を特定し、UI の構造とアプリ内のデータフローを理解して、現在の Leanback 実装を評価します。
TV アプリの個々の画面を Compose に移行して、Compose を段階的に学習し、適応できます。
同じアプリ内で Leanback と Compose の両方を使用して、段階的な移行プロセスを可能にできますが、最初はフラグメント全体を一度に置き換えて、テレビ アプリケーションを 1 つのアクティビティに変換することを目標にします。
小規模で始める。すべてを一度に移行しようとしないでください。設定画面やアカウント画面などの小さなコンポーネントから始めて、徐々にアプリ全体に適用します。
リソース セクションに記載されているリソースのドキュメントと例を参照してください。
Jetpack ライブラリを使用して、Compose for TV の専用コンポーネントを活用します。デザイン ガイドで、すぐに使用できるコンポーザブルをカスタマイズして拡張し、美しいテレビ UI を構築する方法をご確認ください。
Compose の宣言型プログラミング パラダイムをサポートするようにデータと状態の管理を適応します。適応には、アプリ内のデータと状態の管理方法の変更が必要になる場合があります。ViewModel
と Jetpack Compose の内部状態管理メカニズムを使用して、アプリ内のデータと状態を管理します。
アプリの複雑な部分を移行する際は、テストと反復処理を行います。
発生したバグについては、Stack Overflow の Android デベロッパー コミュニティで他のデベロッパーと交流するか、公開バグトラッカーからバグを送信してください。
リソース
Compose を初めて使用する方や、Compose への移行を検討している方のために、最新の Android 開発ツールキットである Jetpack Compose を使用してテレビ UI を構築するためのおすすめの方法を学べるリソースを多数用意しています。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は 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,["# Migrate to Compose for TV\n\nTo migrate from the Leanback UI toolkit to Compose for Android TV, follow these steps:\n\n- **Assess your current Leanback implementation** by identifying the components\n you're using (including those that are provided inside the prefabricated\n fragments) and understanding how your UI is structured and how data flows\n through your app.\n\n- **Migrate individual screens** of your TV app to Compose so you can learn and adapt to Compose\n gradually.\n\n - While you can use both Leanback and Compose within the same app to allow for\n a gradual migration process, begin by replacing entire fragments at a time\n with a goal of converting your TV application into a single activity.\n\n - Start small. Don't try to migrate everything at once. Begin with smaller\n components like settings or account screens and gradually work your way\n through the app.\n\n - Refer to documentation and examples in the resources listed in the\n [Resources](#resources) section.\n\n- **Leverage dedicated components** from Compose for TV by using [the Jetpack\n libraries](/jetpack/androidx/releases/tv). Consult our [design guides](/design/ui/tv/guides/components) to explore\n how you can customize and extend ready-to-use composables to build\n beautiful TV UIs.\n\n- **Adapt your data and state management** to support the Compose [declarative\n programming paradigm](/develop/ui/compose/mental-model#paradigm). Adaptation might require changes in how you manage\n data and state in your app. Use [`ViewModel`](/reference/kotlin/androidx/lifecycle/ViewModel)\n and Jetpack Compose internal state management mechanisms to manage data and\n state in your app.\n\n- **[Test](/develop/ui/compose/testing) and iterate** as you migrate more complex parts of your app.\n\nEngage with the active Android [developer community on Stack\nOverflow](https://stackoverflow.com/questions/tagged/android-jetpack-compose-tv) for any bugs you encounter, or submit the bugs through\nour [public bug tracker](/jetpack/androidx/releases/tv#feedback).\n\nResources\n---------\n\nWhether you're new to Compose or are in the process of migrating to Compose\nalready, our large collection of resources are here to help you learn best\npractices for building TV UIs with the modern Android development toolkit,\nJetpack Compose:\n\n- [Compose for TV integration guides](/training/tv/playback/compose)\n- [TV design guides](/design/ui/tv/guides/components)\n- [Introduction to Compose for TV](/codelabs/compose-for-tv-introduction) codelab\n- [Library release notes](/jetpack/androidx/releases/tv)\n- [JetStream](https://github.com/android/tv-samples/tree/main/JetStreamCompose) video streaming sample app\n- [JetCaster](https://github.com/android/compose-samples/tree/main/Jetcaster/tv-app) audio streaming sample app\n- [Component samples](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:tv/samples/src/main/java/androidx/tv/samples/)"]]