ScrollView in Fragment does not scroll when the soft keyboard shows up - android

I have a Fragment and there is a ScrollView in that Fragment.
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/appbar">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.tatar.mobile.widget.CardSelectionView
android:id="#+id/card_selection_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:accountRightTextView1="#string/available"
app:accountTitleTextView="#string/from"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/line_text_view"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="#color/gray.light"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/card_selection_view" />
<Spinner
android:id="#+id/type_spinner"
style="#style/spinner"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/line_text_view" />
<Spinner
android:id="#+id/company_spinner"
style="#style/spinner"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/type_spinner" />
<LinearLayout
android:id="#+id/dynamic_form_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/company_spinner" />
<Spinner
android:id="#+id/installment_spinner"
style="#style/spinner"
android:layout_marginTop="8dp"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/dynamic_form_container" />
<Button
android:id="#+id/continue_button"
style="#style/action_button"
android:layout_marginTop="16dp"
android:text="#string/continue_button_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/installment_spinner" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
The LinearLayout with the id of dynamic_form_container in that ScrollView contains form input fields which will are populated via a web service call and there might be up to 6-7 input fields depending on the parameters sent to web service. So, height of the form is kind of high and that is where the problem starts. When I try to enter something to an input field, soft keyboard shows up and some of the other input fields stay under the soft keyboard and scrolling is not possible.
I tried to put this to manifest for the Activity of that Fragment but it did not help.
android:windowSoftInputMode="adjustResize|stateHidden"
I want to be able to scroll when the soft keyboard shows up. How can I fix that issue ?
Any help would be appreciated

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
in onCreateView method worked for me.

I have found solution for this problem here, include this class in your project.
And add this following line in onCreate of activity that contains fragment.
new KeyboardUtil(this,findViewById(R.id.fragment));

Hello Please refer below code
this is work for me..
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.constraint.ConstraintLayout>
</ScrollView>
AndroidManifest.xml
<activity
android:name=".ui.activities.Activity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />

Related

RecyclerView in scrollview cut last items

I have fragment with 2 RecyclerView.
I get some data from api and add it for RecyclerViews in ArrayLists, then notify view that data was changed. For some reason, the last element(s) of the RecyclerViews is getting cut-off. When i get 8 object - RVs show only 5 of them. On small screens even less. I am disable RVs scrolling, and want use one ScrollView for all fragment content.
This is the XML of the fragment:s
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".screens.view.MainFragment">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="#+id/onDutyMainRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
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="wrap_content"
android:paddingHorizontal="#dimen/margin_m"
android:paddingVertical="#dimen/margin_m">
<TextView
android:id="#+id/requestTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:fontFamily="#font/sfprotext_semibold"
android:textStyle="bold"
android:textSize="#dimen/on_duty_main_subtitle_font_size"
android:textColor="#color/dark_liver"
android:text="Requests"
tools:text="Requests"/>
<Button
android:id="#+id/showAllRequestsButton"
style="#style/ShowAllButtonDark"
app:layout_constraintBottom_toBottomOf="#+id/requestTitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/requestTitle"
tools:ignore="TouchTargetSizeCheck"
android:text="Show All"
tools:text="Show All" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/requestsRecyclerView"
android:layout_width="match_parent"
android:layout_marginTop="#dimen/on_duty_recycler_view_margin_top"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/requestTitle" />
<TextView
android:id="#+id/groupTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/sfprotext_semibold"
android:textColor="#color/dark_liver"
android:textSize="#dimen/on_duty_main_subtitle_font_size"
android:textStyle="bold"
android:layout_marginTop="#dimen/margin_m"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/requestsRecyclerView"
android:text="Groups"
tools:text="Groups" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/groupsRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/on_duty_recycler_view_margin_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/groupTitle" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
I try found solution in other question like that, but nothing helped me.
For examle, i tryed some solution from RecyclerView is cutting off the last item

Searchable RecyclerView inside BottomSheetDialogFragment that stays expanded and does not wrap content

My app has a BottomSheetDialogFragment which displays list of countries with RecyclerView. When user types in the EditText bottomsheet shrinks in size so as to wrap content. What can I do to make BottomSheet remain the same and not shrink in height. I could not find anything similar on SO, closest thing I got was this article:
https://medium.com/#oshanm1/how-to-implement-a-search-dialog-using-full-screen-bottomsheetfragment-29ceb0af3d41
Can someone explain why this shrinking happens, why the article uses 2 LinearLayouts nested inside each other and provide solution to this problem with thorough explanation?
Here is xml code
<?xml version="1.0" encoding="utf-8"?>
<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">
<TextView
android:id="#+id/tvCountry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/tilSearchCountries"
style="#style/ReBankTIL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/rtvCountry"
app:startIconDrawable="#drawable/ic_search" >
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/tieSearchCountries"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionSearch"
android:inputType="text"
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rvCountries"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="#id/tilSearchCountries" />
</androidx.constraintlayout.widget.ConstraintLayout>

Keyboard won't show for EditText inside a ViewPager2 in a DialogFragment

I have a layout - let's call it layout A - with some EditTexts, which I inflate inside a DialogFragment and all goes well with them. I have another DialogFragment whose layout - let's call it layout B - has a ViewPager2 in it, and I use it with a FragmentStateAdapter which hosts fragments where I reuse layout A for each of them.
Now my problem is that when I tap on the EditTexts inside the ViewPager2, they seem to be getting focus (my grasp of that subject isn't perfect), the cursor starts showing and I can manipulate the text with it ("select", "select all", "cut", etc.), but the soft keyboard won't open up.
In the dialog without the viewPager, those same EditTexts work flawlessly and the keyboard opens up.
In the Android Manifest I have android:windowSoftInputMode="adjustPan"
(I use a single activity in my app).
What could be the problem?
My code:
Layout A:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/title_text_view"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/double_margin"
android:layout_marginLeft="#dimen/double_margin"
android:text="#string/title_colon"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="#id/title_edit_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/title_edit_text" />
<EditText
android:id="#+id/title_edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/double_margin"
android:layout_marginRight="#dimen/double_margin"
android:autofillHints="false"
android:ellipsize="end"
android:hint="#string/enter_track_title"
android:inputType="textCapWords|textMultiLine"
android:maxLines="2"
android:textSize="14sp"
app:layout_constraintBottom_toTopOf="#id/position_edit_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/title_text_view"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/position_text_view"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/double_margin"
android:layout_marginLeft="#dimen/double_margin"
android:text="#string/number_dot"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="#id/position_edit_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/position_edit_text" />
<EditText
android:id="#+id/position_edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin"
android:layout_marginEnd="#dimen/double_margin"
android:layout_marginRight="#dimen/double_margin"
android:layout_marginBottom="#dimen/margin"
android:autofillHints="false"
android:ellipsize="end"
android:hint="#string/enter_track_position"
android:inputType="text"
android:maxLength="6"
android:maxLines="1"
android:textSize="14sp"
app:layout_constraintBottom_toTopOf="#id/duration_text_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/position_text_view"
app:layout_constraintTop_toBottomOf="#id/title_edit_text"
tools:ignore="TextFields" />
<TextView
android:id="#+id/duration_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/duration_colon"
android:textStyle="bold"
android:layout_marginBottom="#dimen/double_margin"
app:layout_constraintBottom_toTopOf="#id/colon_text_view"
app:layout_constraintEnd_toEndOf="#id/seconds_picker"
app:layout_constraintStart_toStartOf="#id/minutes_picker"
app:layout_constraintTop_toBottomOf="#id/position_edit_text" />
<NumberPicker
android:id="#+id/minutes_picker"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/double_margin"
android:layout_marginLeft="#dimen/double_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#id/colon_text_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/duration_text_view" />
<TextView
android:id="#+id/colon_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="#dimen/margin"
android:text="#string/colon"
android:textSize="42sp"
app:layout_constraintBottom_toBottomOf="#id/minutes_picker"
app:layout_constraintEnd_toStartOf="#id/seconds_picker"
app:layout_constraintStart_toEndOf="#id/minutes_picker"
app:layout_constraintTop_toTopOf="#id/minutes_picker"
app:layout_constraintVertical_bias="0.42000002" />
<NumberPicker
android:id="#+id/seconds_picker"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/double_margin"
android:layout_marginRight="#dimen/double_margin"
app:layout_constraintBottom_toBottomOf="#id/minutes_picker"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/colon_text_view"
app:layout_constraintTop_toTopOf="#id/minutes_picker" />
</androidx.constraintlayout.widget.ConstraintLayout>
Layout B:
<?xml version="1.0" encoding="utf-8"?>
<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">
<View
android:id="#+id/edit_track_divider_1"
style="#style/divider"
android:layout_marginTop="#dimen/double_margin"
app:layout_constraintBottom_toTopOf="#id/left_arrow"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="#+id/left_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/quadruple_margin"
android:layout_marginLeft="#dimen/quadruple_margin"
android:layout_marginTop="#dimen/double_margin"
android:background="#android:color/transparent"
android:contentDescription="#string/left_arrow_image"
android:scaleX="1.5"
android:scaleY="1.5"
app:layout_constraintBottom_toTopOf="#id/edit_tracks_pager"
app:layout_constraintEnd_toStartOf="#id/right_arrow"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/edit_track_divider_1"
app:srcCompat="#drawable/ic_action_left" />
<TextView
android:id="#+id/position_header"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="#id/left_arrow"
app:layout_constraintEnd_toStartOf="#id/right_arrow"
app:layout_constraintStart_toEndOf="#id/left_arrow"
app:layout_constraintTop_toTopOf="#id/left_arrow" />
<ImageButton
android:id="#+id/right_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/quadruple_margin"
android:layout_marginRight="#dimen/quadruple_margin"
android:background="#android:color/transparent"
android:contentDescription="#string/right_arrow_image"
android:scaleX="1.5"
android:scaleY="1.5"
app:layout_constraintBottom_toBottomOf="#+id/left_arrow"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/left_arrow"
app:layout_constraintTop_toTopOf="#+id/left_arrow"
app:srcCompat="#drawable/ic_action_right" />
<androidx.viewpager2.widget.ViewPager2
android:id="#+id/edit_tracks_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="#id/edit_track_divider_2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/left_arrow" />
<View
android:id="#+id/edit_track_divider_2"
style="#style/divider"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/edit_tracks_pager" />
</androidx.constraintlayout.widget.ConstraintLayout>
I eventually found some "hackish" unsatisfying way to fix this issue... I have added a dummy EditText in the layout right above the ViewPager2 and set its visibility to gone. Now the EditTexts work as expected - i.e. the keyboard opens up. I have no idea why this works and therefore still don't know what caused the problem. I found this after playing around hopelessly for solutions. If anyone knows what caused the problem, why my solution practically solves it and what is the correct way to solve this - please let me know.

How to stop EditText from moving up when keyboard appears

In a Bottom Navigation Activity I've a Fragment with a button, an EditText and a TextView.
The problem is that when I focus the EditText to write with the keyboard it moves up and the button bugs in it. How can I solve?
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
<TextView
android:layout_width="0dp"
android:layout_height="178dp"
android:gravity="start|top"
android:ems="10"
android:id="#+id/output"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent"
android:autofillHints="" app:layout_constraintVertical_bias="0.386"
app:layout_constraintTop_toBottomOf="#+id/button" app:layout_constraintHorizontal_bias="0.666"
style="#style/Widget.AppCompat.TextView" android:scrollbars="vertical" android:textSize="18sp"
/>
<EditText
android:layout_width="0dp"
android:layout_height="178dp"
android:inputType="textMultiLine"
android:gravity="start|top"
android:ems="10"
android:id="#+id/input"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.666"
android:autofillHints="" android:hint="#string/hint" android:layout_marginTop="16dp"
app:layout_constraintBottom_toTopOf="#+id/button" app:layout_constraintVertical_bias="0.574"
android:scrollbars="vertical"/>
<Button
android:text="#string/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/button"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintHorizontal_bias="0.498" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Use this
' android:windowSoftInputMode="adjustPan" '
in AndroidMenifest.xml file
<activity
android:name=".ui.activity.approve_pending.ApprovalsActivity"
android:windowSoftInputMode="adjustPan" />
You will find more information here https://developer.android.com/training/keyboard-input/visibility
Your constraints are probably what's causing this behavior.
Try removing the bottom constraint on your EditText, and setting the top constraint on your button to the bottom of the EditText instead of the top of the parent. I believe that will fix it.
it work for me ,it grateful ,try it
android:windowSoftInputMode="adjustPan"

Fragments does not resize when the keyboard opens

I have an EditText which listens to click events on an activity and launches a fragment using fragmentTransaction.add(); both the activity and the fragment have a ConstraintLayout as a root ViewGroup. The fragment layout is as follows (Some elements has been omitted for brevity):
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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/fragment_CitySelection"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="25dp"
android:background="#color/white"
android:clickable="true"
android:focusable="true"
tools:context=".CitySelectionFragment">
<EditText
android:id="#+id/city_AutoCompleteTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:background="#layout/rounded_border_edittext"
android:hint="Ville"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:paddingTop="6dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
android:paddingBottom="10dp"
android:textSize="22sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/back_ImageButton" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/cities_RecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/city_AutoCompleteTextView" />
</androidx.constraintlayout.widget.ConstraintLayout>
I tried adding android:windowSoftInputMode="adjustResize" in AndroidManifest and programmatically as of answers in some similar questions.
The problem is caused by some code I added to make the status bar completely transparent, which I found in this answer.
Adding android:fitsSystemWindows="true" to the fragment layout solved the problem.

Categories

Resources