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?
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.
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.
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.
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?
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With