我在布局活动中使用带有可滚动内容的自定义页眉和页脚。我面临的问题是"当键盘弹出"时,Footer会出现键盘。此外,背景图像缩小。即使键盘打开,我也必须在页面底部保持页脚并拉伸图像。我试着设置android:windowSoftInputMode =" stateHidden | adjustPan"但是当我关注最后一个edittext时,我的标题会偏离屏幕。请帮忙。这是我的主要布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/dashboard">
<include
android:id="@+id/toolbar"
layout="@layout/header_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<include
android:id="@+id/footer"
layout="@layout/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer"
android:layout_below="@+id/toolbar"
android:fillViewport="true">
<LinearLayout style="@style/linear_layout_inside_scrollview">
<TextView
style="@style/text_view_white"
android:gravity="center"
android:textSize="@dimen/large_text"
android:lineSpacingExtra="@dimen/line_space"
android:text="@string/email_check_label" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<EditText
style="@style/edit_text_pre_login"
android:layout_marginTop="@dimen/inputs_margin"
android:gravity="center" />
<Button
android:id="@+id/goToMobileCheck"
style="@style/pre_login_button"
android:layout_marginTop="@dimen/inputs_margin"
android:onClick="goToMobileCheck"
android:text="@string/next" />
</LinearLayout>
</ScrollView>
答案 0 :(得分:0)
尝试在ypur布局的此活动中为 AndroidManifest 添加以下内容
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
android:configChanges="keyboardHidden"
答案 1 :(得分:0)
只需使用 -
android:windowSoftInputMode="adjustPan"