【问题标题】:When the lazy column list item is long, the Keyboard covers the Textfield in Jetpack Compose当惰性列列表项较长时,键盘覆盖Jetpack Compose中的Textfield
【发布时间】:2021-04-28 04:52:51
【问题描述】:
  • 我在 jetpack compose 中有一个惰性文本字段列表(大约 10 个 OutlineTextField())
  • 最后几个文本字段被键盘隐藏了
  • 如何将那些下方的文本字段移到键盘上方?谢谢

【问题讨论】:

  • 请发布您的代码
  • 你解决了吗?

标签: android kotlin android-jetpack-compose android-jetpack-compose-text


【解决方案1】:

以您的活动使用的样式将其添加到主题.xml:

adjustResize|stateVisible

或 android:windowSoftInputMode="adjustResize" 在您的清单中包含您的列表的活动

【讨论】:

    【解决方案2】:

    你需要实现accompanist-insets依赖

    implementation "com.google.accompanist:accompanist-insets:<version>"
    // If using insets-ui
    implementation "com.google.accompanist:accompanist-insets-ui:<version>"
    

    然后在 MainActivity 中使用ProvideWindowInsets(windowInsetsAnimationsEnabled = true),如以下代码所示。

    setContent {
            ProvideWindowInsets(windowInsetsAnimationsEnabled = true) {
                MyApplicationTestTheme {
                   //your content goes here
                }
            }
     }
    

    更多详情请查看documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-26
      • 1970-01-01
      • 1970-01-01
      • 2022-11-21
      • 2020-06-22
      • 1970-01-01
      • 2019-03-08
      • 1970-01-01
      相关资源
      最近更新 更多