【问题标题】:Stop softkey from pushing toolbar above screen停止软键推动屏幕上方的工具栏
【发布时间】:2018-09-15 18:02:59
【问题描述】:

我的布局看起来像这样

<LinearLayout>

<Toolbar/>

<Scrollview>

<More views including a edittext in the bottom/>

</Scrollview>

</LinearLayout>

问题是,每当我选择 editext 键入内容时,软键会将 edittext 向上推,这是它应该工作的方式,但整个布局也随之向上推。我想将工具栏保留在屏幕上,就像在 WhatsApp 中,当通过软键上下推动编辑文本时,工具栏仍保留在屏幕上。

【问题讨论】:

标签: android android-toolbar android-softkeyboard


【解决方案1】:

设置一下

<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:isScrollContainer="false">

并将其添加到您的线性布局中

 android:windowSoftInputMode="adjustPan"

【讨论】:

  • 希望对你有帮助!
  • 我必须使用协调器布局吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-12-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多