今天对应一个Android 软键盘遮挡控件的BUG票,就是一个页面最下面控件,除非软键盘,软键盘会遮住控件一部分。很困惑,上网GOOGLE了一下,发现很多人有这哥问题。
他们的解决办法是在 AndroidManifest.xml中 找到对应activity 在里面写上android:windowSoftInputMode="adjustPan"
很高兴的是尝试,但是发现并没有预期效果。
最后发现一个好办法解决此问题,就是在 XML的顶级元素上加一层ScrollView
例如:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<include android:layout_width="fill_parent"
android:layout_height="wrap_content" layout="@layout/title_navi" />
<ViewFlipper android:id="@+id/vfSeason"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:persistentDrawingCache="animation" android:flipInterval="1000"
android:inAnimation="@anim/slide_in" android:outAnimation="@anim/slide_out">
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:stretchColumns="0">
。
。
。
。
</TableLayout>
</ViewFlipper>
</LinearLayout>
</ScrollView>
利用ScrollView在 最外层包一层,问题解决。 因为ScrollView中,所有的文本框在输入法面板弹出的时候都会自动的向上滚动。期望对大家有帮助