Created a LazyColumn with textFields and it seems to have issue with "android:windowSoftInputMode="adjustResize"
parameter.
When clicking a text field that needs to move up so it won't be hidden behind keyboard, causes issues when using AdjustResize
parameter. The keyboard will open and then close again. It seems that textfield has lost a focus when ui is doing adjustResize.
Simple code example:
LazyColumn(state = rememberLazyListState()) {
for (i in 1..20) {
item {
TextField(value = "item{$i}", onValueChange = {})
}
}
}
And in AndroidManifest.xml I have
<activity
android:name=".MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustResize"
...
- Demo to show that keyboard is closed just after it opens. (This issue only happens when to click on item that needs adjustment to be visible when keyboard is open)
LazyColumn Textfield works correctly without
AdjustResize
focused item will be moved up and everything is fine. The reason why I would like to use AdjustResize is that in my actual app I have undo/redo buttons at the bottom of the screen and I would like to move them up when keyboard is opened, but it seems I need to useAdjustResize
to make it work, but that brakes textFields.So I was wondering how can I make LazyColumn TextFields to work with
AdjustResize
? (I'm using latest compose version: 1.3.1)