ListView scrolls down when prepending items
-
I have developed a social media app. I use a ListView to display the timeline of posts. When new posts come in I prepend those at the top of the list. This causes the lists to scroll down sometimes. I see have observed the following:
- If first visible item is the first item of the list then prepending items scrolls down the list causing the new items to become visible.
- If the first visible item is an item further down the list then the above does not happen, if the item height is fixed (see next point)
- The items are highly dynamically, e.g. some posts have images or other attachments. This means the height of the item is not final when it is prepended, e.g. the post text is already there by an Image with a http-url as source is still empty as the http requests is in flight. When the image is received the height of the entry increases. When this happens, all items below are push down. To the user it seems that his timeline suddenly jumps in downwards direction.
In all cases I want the timeline to be stable, i.e. not move at all. Items above the visible area should resize in upwards direction instead of downwards.
Any ideas how to do this?