我有一个 TableLayout,它在 ScrollView 内填充_parent。一切都很完美,除了当显示软键盘时它遮盖了最后几个 EditText。从技术上讲,屏幕无法再向下滚动,因为如果不显示键盘,屏幕就会容纳所有内容。只是当键盘显示时,我无法向下滚动以查看剩余的 EditText,而不隐藏键盘并允许用户仅选择并将值输入到较低的 EditText 之一。使用this http://developer.android.com/resources/articles/on-screen-inputs.html, 我试过了:
Window.SetSoftInputMode((int)SoftInput.AdjustPan);
and
Window.SetSoftInputMode((int)SoftInput.AdjustResize);
and
[Activity(WindowSoftInputMode = SoftInput.AdjustPan)]
and
[Activity(WindowSoftInputMode = SoftInput.AdjustResize)]
and
Window.SetFlags(WindowManagerFlags.AltFocusableIm, WindowManagerFlags.AltFocusableIm);
那根本就阻止了键盘的出现。这不是我需要的。我需要将我的内容调整为在可见时显示在键盘上方,以便我可以继续滚动到显示键盘的最底部 EditText。很长的 xml 的摘录。该表是用代码动态填充的。
<ScrollView
android:id="@+id/peScroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/security">
<TableLayout
android:id="@+id/poweredEquip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:stretchColumns="*"
android:gravity="center"
android:padding="10dip">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/tab_bg_unselected"
android:gravity="center">
<TextView
android:text="Serial"
android:textSize="15sp"
android:textColor="@android:color/black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="middle"
android:gravity="center"
android:layout_column="1"/>
</TableRow>
</TableLayout>
</ScrollView>
可能不是最优雅的解决方案,但决定在最后一行添加一个大的 marginBottom 。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)