leanback-to-compose-tv-migration

Migrates Android TV apps from Leanback UI Toolkit to Jetpack Compose for TV.

2|Updated Jun 21, 2026
One-click install
npx skills add https://github.com/IsKenKenYa/skills --skill leanback-to-compose-tv-migration-iskenkenya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: leanback-to-compose-tv-migration
Source: https://github.com/IsKenKenYa/skills/tree/main/skills/android/tv/leanback-to-compose-tv-migration
Command: npx skills add https://github.com/IsKenKenYa/skills --skill leanback-to-compose-tv-migration-iskenkenya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Migrating an Android TV app from the legacy Leanback UI Toolkit, Android Views, or Support Fragments to Jetpack Compose for TV (androidx.tv) involves tricky focus management, D-pad navigation, and media playback concerns that generic Compose knowledge does not cover. This Skill provides the architecture patterns, component mappings, and phased migration plan needed to complete the transition without focus traps or broken playback. ## Core Features & Use Cases - Component Mapping Guide: Maps legacy classes like BrowseSupportFragment, VideoSupportFragment, GuidedStepSupportFragment, and ArrayObjectAdapter to modern Compose equivalents such as BrowseScreen, PlaybackScreen, and declarative composables. - D-pad Focus Handling: Covers initial focus with FocusRequester, row focus memory with Modifier.focusRestorer, IME focus chaining for login forms, and Back-key interception to avoid focus traps. - Media3 Playback Migration: Replaces legacy PlayerView wrappers with Compose PlayerSurface and Material3 transport controls (PlayPauseButton, SeekBackButton, SeekForwardButton) with D-pad directional seeking. - Use Case: You have a TV app whose browse screen is built on BrowseSupportFragment with Presenters and ArrayObjectAdapters. Use this Skill to rebuild it as a LazyColumn of LazyRows with an immersive hero banner, pivot scrolling via BringIntoViewSpec, and per-row focus restoration. ## Quick Start Migrate my Android TV app's Leanback-based browse and playback screens to Jetpack Compose for TV following the phased migration plan.

Frequently Asked Questions about leanback-to-compose-tv-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate an Android TV app from Leanback to Jetpack Compose?

Follow a five-phase migration: set up a TV Material 3 design system, migrate leaf screens like settings, then core browsing screens, then details and playback, and finally remove legacy Leanback code. Replace fragments like BrowseSupportFragment with composable screens built on LazyColumn and LazyRow.

What is the Compose equivalent of BrowseSupportFragment?

BrowseSupportFragment maps to a BrowseScreen composable built as a LazyColumn containing categorized LazyRows plus a hero banner. Legacy ArrayObjectAdapter, ListRowPresenter, and CardPresenter classes are replaced by declarative composables observing immutable state lists.

How do I handle D-pad focus in Compose for TV?

Assign initial focus with FocusRequester inside a LaunchedEffect, and attach Modifier.focusRestorer to each LazyRow so rows remember the last focused card. Avoid directional overrides targeting items inside lazy lists, which can throw IllegalStateException when items scroll off-screen.

Can I use AndroidView to wrap PlayerView in Compose for TV?

No, wrapping legacy PlayerView or StyledPlayerView in AndroidView is prohibited for TV migration. Use PlayerSurface from androidx.media3.ui.compose with ExoPlayer, layered with Media3 Compose transport controls like PlayPauseButton, SeekBackButton, and SeekForwardButton.

Why does pressing Back exit my TV screen while editing a text field?

On Android TV, the D-pad Back button normally triggers navigation even while a text field is focused. Attach Modifier.onPreviewKeyEvent to intercept Key.Back and Key.Escape on key-up, clearing focus so the user returns to D-pad form navigation without exiting the screen.

Should I use mobile Compose Material3 or androidx.tv.material3 for TV apps?

Always use androidx.tv.material3 (androidx.tv:tv-material) instead of mobile androidx.compose.material3. TV Material 3 provides built-in D-pad focus handling, focus zoom scaling, and TV-optimized typography, and mixing both libraries can cause inconsistent theming.