【发布时间】:2016-02-04 21:25:23
【问题描述】:
我有一个编辑文本,它在打开时成功定位在软件键盘上方。问题是当键盘打开时,键盘是可见的,大约 2 秒后,edittext 被定位。我如何使在键盘打开之前显示在页面底部的编辑文本在键盘向上时进行动画处理?
【问题讨论】:
标签: android keyboard android-edittext window-soft-input-mode
我有一个编辑文本,它在打开时成功定位在软件键盘上方。问题是当键盘打开时,键盘是可见的,大约 2 秒后,edittext 被定位。我如何使在键盘打开之前显示在页面底部的编辑文本在键盘向上时进行动画处理?
【问题讨论】:
标签: android keyboard android-edittext window-soft-input-mode
在 Edittext 的父容器中使用 ScrollView
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</ScrollView>
并将其添加到您在 AndroidManifest 中的活动
android:configChanges="keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="stateHidden|adjustResize"
【讨论】: