0

I used this solution to move to the bottom of the recycler view when user hit send button to send text in EditText. It works well if I input a single line of EditText, however if the EditText has multiple lines in it, the smoothScrollToPosition(message_container.getAdapter().getItemCount() - 1) wont work properly. Assume that my EditText has 4 lines, so the view just scrolls to the first line, not the end of the EditText. Is there any workaround for this? thank kiu.

Dennis Nguyen
  • 278
  • 2
  • 9

2 Answers2

0
 item_recyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrolled(RecyclerView recycler, int dx, int dy) {

                if (!shouldScroll) {
                    recycler.scrollTo(0, 0);
                    item_recyclerview.requestFocus();
                }
            }
        });
eagerprince
  • 115
  • 1
  • 5
0

I had a mistake that I put the recycler view inside a scroll view, so the code I used above didn't work like expected, just remove the scroll view and everything is normal again.

Dennis Nguyen
  • 278
  • 2
  • 9