Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Puedes aplicar Modifier.imeNestedScroll() a un contenedor de desplazamiento para abrir y cerrar el IME automáticamente cuando se desplaza hasta la parte inferior del contenedor.
classWindowInsetsExampleActivity:AppCompatActivity(){overridefunonCreate(savedInstanceState:Bundle?){super.onCreate(savedInstanceState)WindowCompat.setDecorFitsSystemWindows(window,false)setContent{MaterialTheme{MyScreen()}}}}@OptIn(ExperimentalLayoutApi::class)@ComposablefunMyScreen(){Box{LazyColumn(modifier=Modifier.fillMaxSize()// fill the entire window.imePadding()// padding for the bottom for the IME.imeNestedScroll(),// scroll IME at the bottomcontent={})FloatingActionButton(modifier=Modifier.align(Alignment.BottomEnd).padding(16.dp)// normal 16dp of padding for FABs.navigationBarsPadding()// padding for navigation bar.imePadding(),// padding for when IME appearsonClick={}){Icon(imageVector=Icons.Filled.Add,contentDescription="Add")}}}
El contenido y las muestras de código que aparecen en esta página están sujetas a las licencias que se describen en la Licencia de Contenido. Java y OpenJDK son marcas registradas de Oracle o sus afiliados.
Última actualización: 2025-08-26 (UTC)
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-26 (UTC)"],[],[],null,["# Use keyboard IME animations\n\nYou can apply `Modifier.imeNestedScroll()` to a scrolling container to open and\nclose the IME automatically when scrolling to the bottom of the container.\n\n\n```kotlin\nclass WindowInsetsExampleActivity : AppCompatActivity() {\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n\n WindowCompat.setDecorFitsSystemWindows(window, false)\n\n setContent {\n MaterialTheme {\n MyScreen()\n }\n }\n }\n}\n\n@OptIn(ExperimentalLayoutApi::class)\n@Composable\nfun MyScreen() {\n Box {\n LazyColumn(\n modifier = Modifier\n .fillMaxSize() // fill the entire window\n .imePadding() // padding for the bottom for the IME\n .imeNestedScroll(), // scroll IME at the bottom\n content = { }\n )\n FloatingActionButton(\n modifier = Modifier\n .align(Alignment.BottomEnd)\n .padding(16.dp) // normal 16dp of padding for FABs\n .navigationBarsPadding() // padding for navigation bar\n .imePadding(), // padding for when IME appears\n onClick = { }\n ) {\n Icon(imageVector = Icons.Filled.Add, contentDescription = \"Add\")\n }\n }\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/compose/snippets/src/main/java/com/example/compose/snippets/interop/MigrationOtherConsiderationsSnippets.kt#L66-L102\n```\n\n\u003cbr /\u003e\n\n**Figure 3.** IME animations."]]