कीबोर्ड IME ऐनिमेशन का इस्तेमाल करना

स्क्रोल किए जा रहे कंटेनर पर Modifier.imeNestedScroll() लागू किया जा सकता है, ताकि कंटेनर के सबसे नीचे स्क्रोल करने पर, IME अपने-आप खुले और बंद हो जाए.

class WindowInsetsExampleActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        WindowCompat.setDecorFitsSystemWindows(window, false)

        setContent {
            MaterialTheme {
                MyScreen()
            }
        }
    }
}

@OptIn(ExperimentalLayoutApi::class)
@Composable
fun MyScreen() {
    Box {
        LazyColumn(
            modifier = Modifier
                .fillMaxSize() // fill the entire window
                .imePadding() // padding for the bottom for the IME
                .imeNestedScroll(), // scroll IME at the bottom
            content = { }
        )
        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 appears
            onClick = { }
        ) {
            Icon(imageVector = Icons.Filled.Add, contentDescription = "Add")
        }
    }
}

ऐनिमेशन में दिखाया गया है कि कीबोर्ड के लिए जगह बनाने के लिए, यूज़र इंटरफ़ेस (यूआई) एलिमेंट को ऊपर और नीचे स्क्रोल किया जा रहा है
तीसरी इमेज. IME ऐनिमेशन.