Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A recycler view vs the linear layout inside a scroll view?

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.

like image 480
Kalyan Dechiraju Avatar asked Nov 18 '15 04:11

Kalyan Dechiraju


People also ask

What is the difference between ScrollView and RecyclerView?

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.

Is a recycler view scrollable?

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.

When should I use a recycler view?

Use the RecyclerView widget when you have data collections whose elements change at runtime based on user action or network events.

What is the main function of the recycler view?

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.


Video Answer


1 Answers

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.

like image 149
RussHWolf Avatar answered Oct 12 '22 13:10

RussHWolf