There is an application (chat) in which you need to make the display of messages in the form of a list. But it’s not easy to display with the list view xs with text, the view can contain more pictures + view by themselves can be different. With a simple display of the elements, the choice would be ListView . But it is necessary not only to display them, but also to be able to modify them, animate, etc. Having tried to make the list through ScrollView I ran into the problem that ScrollView slows down, as I understood it because the elements are not re-created, but stored in memory! The question is: how is it better to accomplish the necessary task? I personally tend to ScrollView , since, in theory, it should be easier to work with, but how can the problem of braking be solved?

ps maybe someone knows how similar tasks are implemented in Viber, VK and other messanger

    1 answer 1

    Do not use ScrollView , over time it will slow down even more as you add View . Use RecyclerView , there are enough examples on the net. In it, you can specify any View depending on the object that you need to show. In addition, the "cells" in RecyclerView that have gone beyond the screen will be дестроятся . it saves memory.

    UPD In RecyclerView you can override the getItemViewType() method, and depending on the return value, onCreateViewHolder() can substitute the desired View in onCreateViewHolder()