【发布时间】:2021-07-11 05:25:34
【问题描述】:
layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activity.LaunchActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true">
<include
android:id="@+id/header_relative_layout"
layout="@layout/header_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<RelativeLayout
android:id="@+id/body_relative_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footer_linear_layout"
android:layout_below="@+id/header_relative_layout"
android:layout_centerInParent="true" />
<include
android:id="@+id/footer_linear_layout"
layout="@layout/footer_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp" />
</RelativeLayout>
</RelativeLayout>
我想在键盘可见时向上移动整个布局,但是, 只有页脚布局(包含布局)向上移动。 键盘后面还有两个编辑文本和一个按钮。
android:windowSoftInputMode="adjustResize" 被添加到 manifest Activity 中。
在 android:id="@+id/body_relative_layout" 中,我使用 layoutInflater 以编程方式添加了布局。
bodyRelativeLayout.removeAllViews();
bodyRelativeLayout.addView(bodyView);
【问题讨论】:
标签: android android-studio android-layout android-softkeyboard