CopyPastor

Detecting plagiarism made easy.

Score: 0.8488873071326879; Reported for: String similarity Open both answers

Possible Plagiarism

Reposted on 2015-07-03
by Aritra Roy

Original Post

Original - Posted on 2015-07-03
by Aritra Roy



            
Present in both answers; Present only in the new answer; Present only in the old answer;

With the advent of Android Lollipop, the **RecyclerView** made its way officially. The RecyclerView is much more **powerful, flexible and a major enhancement over ListView**. I will try to give you a detailed insight into it.
**Advantages**
**1) ViewHolder Pattern**
In a ListView, it was recommended to use the ViewHolder pattern but it was never a compulsion. In case of RecyclerView, this is mandatory using the [RecyclerView.ViewHolder][1] class. This is one of the major differences between the ListView and the RecyclerView.
It makes things a bit more complex in RecyclerView but a lot of problems that we faced in the ListView are solved efficiently.
**2) LayoutManager**
This is another massive enhancement brought to the RecyclerView. In a ListView, the only type of view available is the vertical ListView. There is no official way to even implement a horizontal ListView.
Now using a RecyclerView, we can have a
i) [LinearLayoutManager][2] - which supports both vertical and horizontal lists,
ii) [StaggeredLayoutManager][3] - which supports Pinterest like staggered lists,
iii) [GridLayoutManager][4] - which supports displaying grids as seen in Gallery apps.
And the best thing is that we can do all these dynamically as we want.
**3) Item Animator**
ListViews are lacking in support of good animations, but the RecyclerView brings a whole new dimension to it. Using the [RecyclerView.ItemAnimator][5] class, animating the views becomes so much easy and intuitive.
**4) Item Decoration**
In case of ListViews, dynamically decorating items like adding borders or dividers was never easy. But in case of RecyclerView, the [RecyclerView.ItemDecorator][6] class gives huge control to the developers but makes things a bit more time consuming and complex.
**5) OnItemTouchListener**
Intercepting item clicks on a ListView was simple, thanks to its [AdapterView.OnItemClickListener][7] interface. But the RecyclerView gives much more power and control to its developers by the [RecyclerView.OnItemTouchListener][8] but it complicates things a bit for the developer.
**Disadvantages**
i) It is way more complex than a list view.
ii) It can take a lot of time for a beginner to understand a RecyclerView fully.
iii) It can unnecessarily make your coding life difficult.
iv) You will need to spend much more time with it than you ever needed for a ListView

[1]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ViewHolder.html [2]: https://developer.android.com/reference/android/support/v7/widget/LinearLayoutManager.html [3]: https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager.html [4]: https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.html [5]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.html [6]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemDecoration.html [7]: http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html [8]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnItemTouchListener.html
With the advent of Android Lollipop, the **RecyclerView** made its way officially. The RecyclerView is much more **powerful, flexible and a major enhancement over ListView**. I will try to give you a detailed insight into it.
**1) ViewHolder Pattern**
In a ListView, it was recommended to use the ViewHolder pattern but it was never a compulsion. In case of RecyclerView, this is mandatory using the [RecyclerView.ViewHolder][1] class. This is one of the major differences between the ListView and the RecyclerView.
It makes things a bit more complex in RecyclerView but a lot of problems that we faced in the ListView are solved efficiently.
**2) LayoutManager**
This is another massive enhancement brought to the RecyclerView. In a ListView, the only type of view available is the vertical ListView. There is no official way to even implement a horizontal ListView.
Now using a RecyclerView, we can have a
i) [LinearLayoutManager][2] - which supports both vertical and horizontal lists,
ii) [StaggeredLayoutManager][3] - which supports Pinterest like staggered lists,
iii) [GridLayoutManager][4] - which supports displaying grids as seen in Gallery apps.
And the best thing is that we can do all these dynamically as we want.
**3) Item Animator**
ListViews are lacking in support of good animations, but the RecyclerView brings a whole new dimension to it. Using the [RecyclerView.ItemAnimator][5] class, animating the views becomes so much easy and intuitive.
**4) Item Decoration**
In case of ListViews, dynamically decorating items like adding borders or dividers was never easy. But in case of RecyclerView, the [RecyclerView.ItemDecorator][6] class gives huge control to the developers but makes things a bit more time consuming and complex.
**5) OnItemTouchListener**
Intercepting item clicks on a ListView was simple, thanks to its [AdapterView.OnItemClickListener][7] interface. But the RecyclerView gives much more power and control to its developers by the [RecyclerView.OnItemTouchListener][8] (**No longer supported, please refer to AndroidX**) but it complicates things a bit for the developer.
In simple words, the RecyclerView is much more customizable than the ListView and gives a lot of control and power to its developers.

[1]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ViewHolder.html [2]: https://developer.android.com/reference/android/support/v7/widget/LinearLayoutManager.html [3]: https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager.html [4]: https://developer.android.com/reference/android/support/v7/widget/GridLayoutManager.html [5]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.html [6]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemDecoration.html [7]: http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html [8]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.OnItemTouchListener.html

        
Present in both answers; Present only in the new answer; Present only in the old answer;