2

I am developing a chat app, and when I open a chat with images (that I am loading using Fresco), it scrolls automatically. Initially, I was using Picasso for loading image, but I tried changing it with other libraries, but the issue remained same. Can anyone guide me what could be the issue or what is the right direction to fix the issue?

zohaib khaliq
  • 697
  • 10
  • 17

3 Answers3

0

Try this call

recyclerView.scrollToPosition(yourListMessages.size() - 1);

It will set to bottom of your list of messages

Abner Escócio
  • 2,697
  • 2
  • 17
  • 36
-1

To avoid this issue, either use image placeholders while an image is loading or establish a minimum size for your cell that's close to the size of the image once it's loaded. It looks your cell is re-sized to fit the image when loading is done, causing rest of the content in your recycler view to shift to accommodate new cell size.

Another thing to try is to set a defined height on your ImageView and use any of the options from android:scaleType to match how you display an image in your cell based on your needs.

C0D3LIC1OU5
  • 8,600
  • 2
  • 37
  • 47
-1

Delayed the call to scrollToPosition until recycler view item gets loaded.

zohaib khaliq
  • 697
  • 10
  • 17