3

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)

enter image description here

  • 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 use AdjustResize 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)

z.g.y
  • 5,512
  • 4
  • 10
  • 36
Courtesy
  • 198
  • 1
  • 9
  • 1
    It sounds like you're running into this bug https://issuetracker.google.com/179203700, which actually has several related issues (e.g., https://issuetracker.google.com/195049010). Unfortunately, I'm not sure if there's a good workaround while using AdjustResize. – Ian G. Clifton Nov 16 '22 at 02:13
  • 1
    Also similar question recently https://stackoverflow.com/questions/74291380/how-to-write-text-into-textfields-in-a-lazycolumn-at-the-bottom-of-the-screen, with a link to another one explained really well on the answer – z.g.y Nov 16 '22 at 02:21
  • Thanks for answers and yes it's duplicate of https://stackoverflow.com/questions/74291380/, before posting I was looking is there something similar, but somehow I missed this post – Courtesy Nov 16 '22 at 20:47

0 Answers0