Am trying to create a page with a scrollable list. Features would be a normal list to remove item by clicking on it. Number of items in that list are limited and added dynamically by user. You can consider a to do list as example. Now which would be a better approach to implement it? Recycler view with data bound to its adapter? Or the normal linear layout with items added as children at run time?
My current implementation is recycler view. But,I found it lagging and animations are not performing well. So a linear layout is auto animated by specifying it xml -- by setting animate layout changes to true.
FYI data is local and syncs in background.
In the practical on scrolling views, you use ScrollView to scroll a View or ViewGroup . ScrollView is easy to use, but it's not recommended for long, scrollable lists. RecyclerView is a subclass of ViewGroup and is a more resource-efficient way to display scrollable lists.
To help you build apps with lists, Android provides the RecyclerView . RecyclerView is designed to be very efficient, even with large lists, by reusing, or recycling, the views that have scrolled off the screen.
Use the RecyclerView widget when you have data collections whose elements change at runtime based on user action or network events.
RecyclerView makes it easy to efficiently display large sets of data. You supply the data and define how each item looks, and the RecyclerView library dynamically creates the elements when they're needed. As the name implies, RecyclerView recycles those individual elements.
Never use a LinearLayout
for anything longer than a single screen. The whole point of ListView
and RecyclerView
is to efficiently reuse views instead of needing to hold things in memory when they're not visible. Maybe you can refine or reask your question so people can help you with whatever difficulty you're having with animations, rather than avoiding the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With