Android windowSoftInputMode =“adjustPan”滚动一些

时间:2013-07-02 10:40:36

标签: android android-layout android-view android-xml

请考虑以下视图示例:

<LinearLayout>
    <EditText />
    <Button />
</LinearLayout>

在清单文件中:

android:windowSoftInputMode="adjustPan"

onfocus edittext,软键盘覆盖了一个按钮,如下所示:

enter image description here

但我喜欢这样:

enter image description here

如何滚动视图以使按钮可见?

2 个答案:

答案 0 :(得分:14)

我刚发现这篇文章,看到它没有得到答复。为了帮助其他可能来的人 在活动清单中使用它

android:windowSoftInputMode="stateUnchanged|adjustResize"

尝试一下,看看是否符合您的需求。

祝你好运

答案 1 :(得分:-1)

可以在按钮下面添加一个空的RelativeLayout。 设置它的android:layout_height =“50dp”或满足您需要的任何值。 并使用ScrollView,注意ScrollView只能有1个子布局。

<ScrollView >
  <LinearLayout>
    <EditText />
    <Button />
    <RelativeLayout 
      android:layout_height="50dp"
      android:layout_width="match_parent" />
  </LinearLayout>
</ScrollView>
相关问题