需求:
注册页面,当点击任一输入框时,底部软键盘弹出,并一直在注册下方,看图效果
技术:
非全屏时:
adjustResize+ScrollView(EditText)+布局设置Bottom=软键盘在指定控件之上显示
全屏时:
adjustResize+ScrollView(EditText)+布局设置Bottom+ 布局根部(android:fitsSystemWindows=“true”)=软键盘在指定控件之上显示
实现:
1,在AndroidManifest.xml中的activity中设置android:windowSoftInputMode=“adjustResize”
2,直接贴上布局代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:fitsSystemWindows="true"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
andro