Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RecyclerView doesn´t keep items scrolled at bottom when softkeyboard pops up

When I focus on an edittextview on my chat activity, the recyclerview doesn´t keep the items stacked at the bottom when resizing the view. Previuosly with a ListView was working. I´ve tried any stackFromEnd, reverseLayout parameter.

Basically I want the same behaviour as any chat: whatsapp, telegram, etc.

Somebody has any idea why does it happen?

like image 536
datienza Avatar asked Sep 29 '15 14:09

datienza


People also ask

What is the problem with recyclerview recycling the views?

99% of the time, this is a problem with recyclerview recycling the views. The 1% percent left could come from human error. Let’s quickly revisit how RecyclerView works. How does RecyclerView work? RecyclerView can easily be called the better ListView.

How does recyclerview work in Android?

RecyclerView, as its name suggests, recycles views once they get out of scope (screen) with the help of ViewHolder pattern. So how does this affect your app? Just like I wrote up there, RecyclerView recycles the views once they get out of the screen. While trying to reuse the cache view, binding with the new data sometimes goes wrong.

Which is better recyclerview or listview?

RecyclerView can easily be called the better ListView. It works just like a ListView — displays a set of data on the screen but uses a different approach for the purpose. RecyclerView, as its name suggests, recycles views once they get out of scope (screen) with the help of ViewHolder pattern.

What is recyclerview in Salesforce?

RecyclerView can easily be called the better ListView. It works just like a ListView — displays a set of data on the screen but uses a different approach for the purpose. RecyclerView, as its name suggests, recycles views once they get out of scope (screen) with the help of ViewHolder pattern. So how does this affect your app?


1 Answers

I had the same situation, and this is how it is fixed: Use mLayoutManager.setStackFromEnd method in code. Setting in XML is not respected by android (in my situation).

    mLayoutManager = new LinearLayoutManager(this);
    mLayoutManager.setStackFromEnd(true);
    mRecyclerView.setLayoutManager(mLayoutManager);
like image 154
guness Avatar answered Oct 29 '22 19:10

guness