I have a layout something like this
<androidx.constraintlayout.widget.ConstraintLayout
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="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@ id/static_total_view"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@color/black"
android:gravity="bottom"
android:orientation="vertical"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent" />
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@ id/static_total_view"
app:layout_constraintTop_toTopOf="parent">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@ id/slot_selector_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_8"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="6" />
<EditText
android:id="@ id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
However, the keyboard is pushing the bottom black view (second screenshot). If I remove RecyclerView
then the keyboard works as expected and the black view is underneath (the first screenshot).
I tried the app:layout_behavior="@string/appbar_scrolling_view_behavior"
.. its not working.
Any help or suggestion! Thanks in advance
CodePudding user response:
You can solve this programmatically by setting the window soft input mode to SOFT_INPUT_ADJUST_PAN
:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);