Hey everyone, I'm facing a weird issue around ime ...
# compose
v
Hey everyone, I'm facing a weird issue around ime inset padding when using XML EditText in Compose This is my reproducer, my original code has a similar structure
Copy code
Scaffold(
    modifier = Modifier.fillMaxSize(),
    bottomBar = {
        Surface(
            modifier = Modifier
                .fillMaxWidth()
                .imePadding(),
            tonalElevation = 2.dp
        ) {
            Text("BottomAppBar", modifier = Modifier.padding(24.dp))
        }
    },
    contentWindowInsets = WindowInsets(0.dp)
) { innerPadding ->
    LazyColumn(
        modifier = Modifier
            .fillMaxSize()
            .padding(innerPadding),
        contentPadding = PaddingValues(24.dp),
        verticalArrangement = Arrangement.spacedBy(12.dp)
    ) {
        item {
            Box(
                modifier = Modifier
                    .height(600.dp)
                    .fillParentMaxWidth()
                    .background(androidx.compose.ui.graphics.Color.Red)
            )
        }
        item {
            TextBox(modifier = Modifier.fillParentMaxWidth())
        }
    }
}

@Composable
fun TextBox(modifier: Modifier = Modifier) {
    TextField(value = "", onValueChange = {}, modifier = modifier)
}

@Composable
fun XMLTextBox(modifier: Modifier = Modifier) {
    AndroidView(
        modifier = modifier,
        factory = { EditText(it).apply { this.setBackgroundColor(Color.LTGRAY) } }
    )
}
Now when I'm using Compose TextField the scaffold correctly moves the content up and I can see my Text Field But when using the XML one, it gets hidden by keyboard Can anyone help me out?
d
You can try to add
androidx.compose.foundation.layout.imePadding
to
LazyColumn
. Or change
android:windowSoftInputMode
in AndroidManifest for correct work of XML EditText
v
@Dmitriy Gaiduk I have already tried using
imePadding()
to the LazyColumn, but that leaves alot of blank space below the text field I tried using both
adjustPan
and
adjustResize
for the
softInputMode
in
Manifest
, but its still the same