adaptive
Qué hace
Esta skill guía la adaptación de una app de Android hecha con Compose a distintos tamaños de pantalla y dispositivos. Cubre la navegación, los diseños de varios paneles, las listas y el mantenimiento del estado al girar el dispositivo. Es para desarrolladores de Android cuya app debe funcionar más allá de los teléfonos.
Cuándo usarla
- ✓Cuando quieres que una app de Android funcione bien en tablets y plegables, además de en teléfonos.
- ✓Cuando necesitas un diseño de varios paneles o una barra de navegación que cambie con el tamaño de la pantalla.
- ✓Cuando quieres que las pantallas y la reproducción multimedia de tu app mantengan su estado tras los cambios de configuración.
Link de la skill
https://github.com/android/skills/blob/main/jetpack-compose/adaptive/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Haz que mi app de Android con Compose se adapte a tablets, plegables y ventanas de escritorio.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La skill empieza asegurándose de que existan pruebas de capturas de pantalla para los tamaños principales, y después hace que la navegación, los diseños y las listas se adapten paso a paso. También gestiona la conservación del estado y el soporte para plegables.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Prerequisites
The app must:
- Use Compose for all screens. If it's still using Fragments or Views, suggest using the XML to Compose skill to migrate those screens.
- Use Jetpack Navigation 3. If it doesn't, suggest the Navigation 3 skill to migrate the app.
Workflow to make an app adaptive
To make an app adaptive, follow these steps or a subset of them adapting to the task.
- Step 1: Verify current UI
- Step 2: Make the navigation bar adaptive
- Step 3: Add multi-pane layouts
- Step 4: Make vertical lists adaptive by changing the number of columns
- Step 5: Hide app bars when scrolling
- Step 6: Preserve UI state across configuration changes
- Step 7: Add desktop experiences
- Step 8: Support foldable devices
Step 1. Verify current UI
Ensure that screenshot tests exist to verify the current UI on different form factors. If they don't exist, add the Compose Preview Screenshot Testing tool. Use the following annotation to create previews for all the major form factors. For example:
@Preview(name = "Phone", device = Devices.PHONE, showBackground = true)
@Preview(name = "Foldable", device = Devices.FOLDABLE, showBackground = true)
@Preview(name = "Tablet", device = Devices.TABLET, showBackground = true)
@Preview(name = "Desktop", device = Devices.DESKTOP, showBackground = true)
annotation class FormFactorPreviews
@PreviewTest
@FormFactorPreviews
@Composable
fun FeedScreenPreview() {
SnippetsTheme {
Box {
Text("My Screen")
}
}
}
<br />
Step 2. Make the navigation bar adaptive
Bottom navigation bars are optimized for touch input when the user is holding a phone in portrait mode. On larger screen hand-held devices, like tablets and unfolded foldables, the navigation area must be accessible from the edge of the screen (navigation rail).
If you need to provide more screen space for the content, hide the navigation area. Examples of this include:
- Hiding the navigation bar when the user scrolls down and showing it again when the user scrolls up. The assumption is that when the user is scrolling down, they are consuming content but when scrolling up they are trying to navigate away from that content.
- Hiding the navigation area when its content is distracting. For example, in camera previews or when displaying a full-screen photo.
When the detail screen is displayed full-screen on mobile, full-screen mode must be deactivated on larger screens.
Steps to migrate:
- Locate the existing navigation bar.
- Convert each item to a
NavigationSuiteItem. - Identify whether the navigation bar's visibility changes. For example, if it is wrapped with an
AnimatedContentorAnimatedVisibilitycomposable. If so, follow the guidance in the "Control navigation area visibility". - Replace the container that held the navigation bar (often a
Scaffold) withNavigationSuiteScaffoldfrom the Material 3 adaptive layouts library. - Supply the navigation items using the
navigationItemsparameter ofNavigationSuiteScaffold.
Step 2.1. Control navigation area visibility
If the navigation bar's visibility changes - it is hidden under certain
scenarios or on certain screens - this behavior must be maintained with the
adaptive navigation area. This is done using NavigationSuiteScaffold's state
parameter.
Steps to migrate:
- Identify the scenarios under which the navigation bar is hidden. This is usually done with a boolean variable for the visibility. Use
isNavBarVisibleorshouldShowNavBaras the variable name. - Create an instance of
NavigationSuiteScaffoldStateusingrememberNavigationSuiteScaffoldState()and pass it toNavigationSuiteScaffold. - When the navigation area visibility changes, use a
LaunchedEffectto callshoworhideon theNavigationSuiteScaffoldState.
For example:
// Pass this variable to any composable that needs to control the navigation area visibility
var isNavBarVisible by remember { mutableStateOf(true) }
val scaffoldVisibilityState = rememberNavigationSuiteScaffoldState()
NavigationSuiteScaffold(
navigationSuiteItems = navItems,
state = scaffoldVisibilityState
) {
// Main content
}
LaunchedEffect(isNavBarVisible){
if (isNavBarVisible) {
scaffoldVisibilityState.show()
} else {
scaffoldVisibilityState.hide()
}
}
<br />
Step 3. Add multi-pane layouts using Navigation 3
Preguntas frecuentes
¿Qué debe usar ya la app?
La app debe usar Jetpack Compose para sus pantallas y Jetpack Navigation 3. Si no es así, la skill propone migrar antes.
¿Añade pruebas?
Sí. Se asegura de que existan pruebas de capturas de pantalla para comprobar la interfaz actual en distintos formatos.
¿Admite ratón y teclado?
Sí. La skill cubre dispositivos de puntero como el ratón y la entrada de texto con teclado.
Detalles
Descripción original del autor
Instructions to make or update an app's UI so that it adapts to different Android devices including phones, tablets, foldables, laptops, desktop, TV, Auto, and XR. It includes how to handle different window sizes, pointing devices (such as mouse) and text entry devices (such as keyboard) using the Compose MediaQuery API, and how to preserve UI, navigation, scroll, and media playback state across configuration changes (such as folding/unfolding a foldable, rotating a device, or resizing a window). It also covers multi-pane layouts using Navigation3 Scenes, adaptive UI components (such as button
repo: android/skills
Popularidad
- Estrellas en GitHub
- 10 mil
- Posición en el ranking
- #11918
- Licencia
- Apache-2.0
- Actualizada
- 29/10/2026
Comentarios
- …
Más skills de este repositorio
agp-9-upgrade
10 milAyuda a tu agente a actualizar una app de Android a Android Gradle Plugin 9 y a resolver sus cambios incompatibles. No sirve para proyectos multiplataforma.
camerax
10 milAyuda a tu agente a crear funciones de cámara en Android con CameraX, incluida la grabación de vídeo, los controles del hardware y los efectos de ML Kit y Media3.
android-for-cars-parked-apps
10 milAyuda a tu agente a adaptar una app de Android de vídeo, juegos o navegador para que funcione como app aparcada en Android Auto y Android Automotive.
appfunctions
10 milAyuda a tu agente a encontrar los flujos de trabajo clave de una app de Android y a exponerlos como AppFunctions que los agentes de IA y los comandos de voz pueden ejecutar.
Skills parecidas
android-clean-architecture
280 milHace que tu agente organice proyectos de Android de forma eficiente. Estructura el código para facilitar el mantenimiento y el desarrollo de nuevas funciones.
compose-multiplatform-patterns
280 milAyuda a tu agente a usar patrones de Compose Multiplatform y Jetpack Compose en proyectos KMP, incluyendo estado, navegación, temas y rendimiento.
dart-flutter-patterns
280 milHace que tu agente escriba código para apps de Dart y Flutter. Usa patrones modernos para crear apps robustas y fáciles de mantener.