软键盘在EditText上



我有androidx.core.widget.NestedScrollView与MaterialCardView和RecyclerViewBelow。

<androidx.core.widget.NestedScrollView 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:id="@+id/pool_activity_root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".view.activity.TicketActivity"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.card.MaterialCardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:elevation="1dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
...
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/comments_list_row"
android:layout_width="0dp"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/card"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>

在RecyclerView我有一些EditTexts。在焦点软键盘是在和EditText有时下,所以编辑的文本是不可见的。

我试着补充android: fitsSystemWindows ="true"和android: windowSoftInputMode ="adjustResize"要显化,但一点用都没有

如果有人有类似的问题:https://gist.github.com/grennis/2e3cd5f7a9238c59861015ce0a7c5584 -这是我使用的一个解决方案,它工作完美