Hello.

There is a Layout in which there is a RecyclerView and a Footer tied to the bottom of the screen. The markup itself:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:id="@+id/listChat" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="vertical" android:overScrollMode="never" android:layout_above="@+id/listFooter"/> <LinearLayout android:id="@+id/listFooter" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:orientation="horizontal"> <EditText android:id="@+id/messageInput" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:inputType="textShortMessage" android:lines="1" android:singleLine="true" android:hint="Введите сообщение"/> <ImageButton android:id="@+id/sendButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_menu_send" /> </LinearLayout> 

In the manifest:

 <activity android:name=".MessagingActivity" android:label="@string/app_name" android:theme="@style/AppTheme" android:windowSoftInputMode="adjustResize" /> 

The problem is that I cannot bring the RecyclerView to a lower state when I open the keyboard. Those. its position remains the same as before the opening of the keyboard. Before that there was a ListView and everything worked fine.

If it is visual, then initially it looks like this:

1st image

Clicking on EditText now looks like this:

2nd image

But you need to look like this:

3rd image

Tried to put onClickListener on EditText and with a delay to cause

 recyclerView.scrollToPosition(chatRecyclerAdapter.getItemCount() - 1); 

But it works every other time. I also tried to change various attributes of RecyclerView , but did not bring success. Perhaps someone knows how to implement it.

Thank you in advance for your response.

  • Try adding android:stackFromBottom="true" for RecyclerView. - Yura Ivanov
  • @YuraIvanov also tried - did not help - ahgpoug
  • one
    @ahgpoug, and if adjustPan instead of adjustResize try? - Yuriy SPb
  • @Yuriy SPb yes, now it's ok. I understand that the toolbar always hidden when using adjustPan ? - ahgpoug
  • @ahgpoug, I can not say for sure. I think it depends on how the toolbar is done. If he is in the CoordinatorLayout, then I think he should be hiding. If you put it directly above the recyclerView in the markup, it may not be removed. - Yuriy SPb

1 answer 1

Most likely a change in the manifest to adjustResize to adjustPan

  • I understand that the question has long been closed, but I just discovered that with the keyboard open and adjustPan , RecyclerView will not scroll to the very top. At the same time to the very top is not enough just the distance of the open keyboard. Is it possible to do something about it? - ahgpoug