datienza
datienza

Reputation: 351

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?

Upvotes: 5

Views: 2191

Answers (1)

guness
guness

Reputation: 6656

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);

Upvotes: 9

Related Questions