3

I'm working on simple chat app. When user open chat activity he has to see the messages scrolled to the bottom. But now it doesn't scroll to the bottom. It scrolls to the middle of the last message. See screenshot: enter image description here

The second problem is - when I click in EditText field to type new message, the keyboard is hiding my messages. I expected to pull up the EditText field with Messages but it just pull up EditText without Messages. Se the screen shot: enter image description here

How to scroll to very bottom of RecyclerView and how to pull up edit text with messages?

My code look like this:

messagesRecycler = findViewById(R.id.messagesRecycler);
messagesRecycler.setHasFixedSize(true);
layoutManagerMess = new LinearLayoutManager(this);
layoutManagerMess.scrollToPosition(messages.size() - 1);
adapterMessages = new AdapterMessages(messages, this, avatar);
messagesRecycler.setLayoutManager(layoutManagerMess);
messagesRecycler.setAdapter(adapterMessages);
Nastro
  • 1,719
  • 7
  • 21
  • 40

0 Answers0