1

If you're using Telegram, you may have seen, if you keep last visible item on X, when keyboard opens, you still see item X and if you close the keyboard, the item X is still on its position.

example:

when keyboard is closed already:

Item 1

Item 2

when keyboard is opened:

item 1

item 2

keyboard

when you close the keyboard, the first step is what you will see.

I want to implement something like that. How can I do this?

Alex
  • 1,623
  • 1
  • 24
  • 48

1 Answers1

3
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity().getBaseContext());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
linearLayoutManager.setStackFromEnd(true);

setStackFromEnd() property solved this question.

slinden77
  • 3,378
  • 2
  • 37
  • 35
Alex
  • 1,623
  • 1
  • 24
  • 48