מעבר לכתיבה בטלוויזיה
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
כדי לעבור מ-Leanback UI toolkit ל-Compose for Android TV, פועלים לפי השלבים הבאים:
כדאי לבדוק את ההטמעה הנוכחית של Leanback. לשם כך, צריך לזהות את הרכיבים שבהם אתם משתמשים (כולל אלה שכלולים בקטעים מוכנים מראש) ולהבין את המבנה של ממשק המשתמש ואת אופן זרימת הנתונים באפליקציה.
להעביר מסכים נפרדים מאפליקציית הטלוויזיה אל Compose, כדי שתוכלו ללמוד ולהתאים את עצמכם בהדרגה ל-Compose.
אפשר להשתמש גם ב-Leanback וגם ב-Compose באותה אפליקציה כדי לאפשר תהליך העברה הדרגתי, אבל מומלץ להתחיל בהחלפת קטעים שלמים בכל פעם, במטרה להפוך את אפליקציית הטלוויזיה לפעילות אחת.
כדאי להתחיל בקטן. אל תנסה להעביר את כל הנתונים בבת אחת. כדאי להתחיל ברכיבים קטנים יותר, כמו הגדרות או מסכי חשבון, ולהמשיך בהדרגה לרכיבים אחרים באפליקציה.
תוכלו לעיין במסמכי העזרה ובדוגמאות במקורות המידע שמפורטים בקטע מקורות מידע.
משתמשים ברכיבים ייעודיים מ-Compose for TV באמצעות ספריות Jetpack. כדאי לעיין במדריכי העיצוב שלנו כדי ללמוד איך להתאים אישית ולהרחיב רכיבים מורכבים מוכנים לשימוש כדי ליצור ממשקי משתמש יפים לטלוויזיה.
התאמת ניהול הנתונים והמצב כך שיתמכו בפרדיגמת התכנות ההחלטית של Compose. יכול להיות שההתאמה תחייב שינויים באופן שבו אתם מנהלים את הנתונים והמצב באפליקציה. כדי לנהל את הנתונים והמצב באפליקציה, תוכלו להשתמש ב-ViewModel
ובמנגנונים הפנימיים לניהול המצב של Jetpack Compose.
בודקים ועורכים ניסויים חוזרים כשעוברים חלקים מורכבים יותר באפליקציה.
אם נתקלתם בבאגים, אתם יכולים לפנות לקהילת המפתחים הפעילה של Android ב-Stack Overflow או לשלוח את הבאגים דרך כלי המעקב הציבורי אחרי באגים.
משאבים
בין שאתם משתמשים חדשים ב-Compose ובין שאתם כבר בתהליך המעבר אליו, אוסף המשאבים הגדול שלנו יעזור לכם ללמוד את השיטות המומלצות ליצירת ממשקי משתמש לטלוויזיה באמצעות ערכת הכלים המודרנית לפיתוח Android, Jetpack Compose:
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[null,null,["עדכון אחרון: 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/)"]]