Sunday 15 February 2015

android - How to prevent RecyclerView from moving items? -


I am trying to implement a layout which is basically a grid of objects of the same size.

Items are ordered, there are dates in a calendar on this, so why can you do so that I can not be sorted randomly every time I scroll .

My question is: is there a way to stop this behavior or should I just stick with the old gridlate?

I am also saying this because I initially thought that the new recycle view was used only for randomly sorted items like news articles or posts. This will explain the difficulties in controlling his behavior.

However, after some reading and web-search, now I think, correct me, if I am wrong, then RecyclerView is an advanced version of ListView, grid layout and some others, which have its layout Implemented by the manager.

Can anyone help me with it?

Thank you!

Edit: This is my adapter:

  Public class cardAssenz adapter recyclerview.adapter and LT; CardEssenseAdapter.Assenjewellder & gt; {Private list & lt; Assenza & gt; List; Reference C; Public CardAssenseAdapter (reference C, list & lt; assenza & gt; list) {this.c = c; This.list = list; } @ Override Public Intake Count () {Return list.size (); } @ Override Public Zero Adoption Handler (AsenjeviHihlder NewsViewhoulder, Int I.) {Esenza N = List.Gate (I); AssenzeViewHolder.month.setText (n.getMeseS ()); AssenzeViewHolder.day.setText (n.getGiornoS ()); If (N. Arteardo ()) Assenjehilholler Horset Text (NJTprro ()); } @ Override Public Associated on Creative Holder (see group view group, int i) {View item view = layout viewer (viewGroup.getContext ()). Flowers (R. LateoutCard, View Group, Incorrect); New AssenzeViewHolder return (itemView); } Public stable class AssenzeViewHolder RecyclerView.ViewHolder {Monthly Preserved Static TextView; Protected static text view day; Protected static textview hours; Public AssenzeViewHolder (see V) {Super (V); Month = (text view) v.findViewById (R.D.Messe); Day = (text view) v.findViewById (R.id.giornoA); Hour = (text view) v.findViewById (R. OROR); }}}}  

There is nothing to do with the irregular order of recyclable view Its purpose is more about using resources more efficiently, here's a quote from the Android Developer Page,

" There is a more advanced and flexible version of the listing. There is a container to display large data sets that can be scrolled very limited Use RecyclerView Widget when you have a data collection whose elements change on the runtime based on user activity or network events. "

Order your items, this is about the data set you provided to Recycling Wives. So if your dataset is not sorted by date, or etc., then you have to sort your data set and then attach it to the recycling view.

And you can take a look at its implementation.


No comments:

Post a Comment