解决方案:在软键盘弹出后,可以上滑布局,从而显示遮挡部分
1、在布局文件中加入ScrollView包裹需要上滑的部分
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/dp_64"
android:src="@drawable/scan_input_icon" />
<EditText
android:id="@+id/etInputNumbert"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_marginEnd="@dimen/dp_46"
android:layout_marginStart="@dimen/dp_46"
android:layout_marginTop="@dimen/dp_40"
android:background="@drawable/et_border_bottom_white_background"
android:clickable="true"
android:drawablePadding="@dimen/dp_7"
android:ellipsize="end"
android:focusable="true"
android:hint="@string/input_correct_number_hint"
android:maxLines="1"
android:paddingEnd="@dimen/dp_7"
android:textColor="@color/color_303030"
android:textColorHint="@color/color_ff8b8b8b"
android:textSize="@dimen/sp_13" />
<Button
android:id="@+id/btn_commit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_46"
android:layout_marginEnd="@dimen/dp_46"
android:layout_marginStart="@dimen/dp_46"
android:layout_marginTop="@dimen/dp_67"
android:background="@drawable/btn_corner_shadow_blue_background"
android:text="@string/enter"
android:textColor="@color/color_ffffff"
android:textSize="@dimen/sp_17" />
</LinearLayout>
</ScrollView>
2、在AndroidManifest的该activity节点中加入
android:windowSoftInputMode="stateVisible|adjustResize"