软键盘在 EditText 之上
Soft keybord is over 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 中我有一些 EditText。 On focus Soft keybord is on and EditText is sometimes under 所以编辑的文本不可见。
我尝试添加
android:fitsSystemWindows="真"
和
android:windowSoftInputMode="调整调整大小"
显化但它根本没有帮助。
万一有人遇到类似问题:
https://gist.github.com/grennis/2e3cd5f7a9238c59861015ce0a7c5584 - 这是我使用的解决方案,效果很好
我有 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 中我有一些 EditText。 On focus Soft keybord is on and EditText is sometimes under 所以编辑的文本不可见。
我尝试添加 android:fitsSystemWindows="真" 和 android:windowSoftInputMode="调整调整大小" 显化但它根本没有帮助。
万一有人遇到类似问题: https://gist.github.com/grennis/2e3cd5f7a9238c59861015ce0a7c5584 - 这是我使用的解决方案,效果很好