Android(安卓)输入法键盘遮挡控件问题的解决办法
16lz
2021-01-26
输入法键盘遮挡控件,有两种办法可以解决:
第一种:
在 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中,所有的文本框在输入法面板弹出的时候都会自动的向上滚动。期望对大家有帮助 |
更多相关文章
- Android(安卓)studio 高级控件提示文本框与下拉框
- Android:控件布局(表格布局)TableLayout
- 【Android(安卓)界面效果18】Android软件开发之常用系统控件界面
- Android双向滑动控件
- Android(安卓)UI开发第三十四篇——SlidingPaneLayout
- Android:RelativeLayout 内容居中
- Android(安卓)popupwindow在指定控件正下方滑动弹出效果
- Android(安卓)TextView控件某个字符串特殊效果