当我动态添加视图时,键盘在EditText上重叠

时间:2012-05-24 21:45:00

标签: android

我正在动态地将视图(RelativeLayoutEditText)添加到FrameLayout并使用setTranslate方法设置其位置。但是我的EditText屏幕键盘重叠。

我试过设置

android:windowSoftInputMode="stateHidden|adjustResize|adjustPan"
清单中的

,但仍然没有结果。我正在使用11 SDK。

如何解决这个问题?

这是screeshots:

enter image description here enter image description here

4 个答案:

答案 0 :(得分:2)

因为你已经在你的Manifest中尝试了android:windowSoftInputMode的活动。你可以通过将Layout布局为relative来使你的EditText android:layout_alignParentBottom =“true”

请参阅此Example

答案 1 :(得分:2)

使用<ScrollView>围绕您的相对布局。

答案 2 :(得分:1)

将您的视图置于其中。 ScrollView只接受一个孩子,所以你可能需要将所有组件添加到LinearLayout,然后在ScrollView中添加LinearLayout。

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


</ScrollView>

如果那不是你想要的,那么添加

android:layout_alignParentBottom="true"

答案 3 :(得分:0)

唯一对我有用的是在该特定活动标签内的清单文件中添加更新,该标签托管的片段的布局在滚动时产生问题。解决方案如下:

android:windowSoftInputMode="stateVisible|adjustPan"
相关问题