How to add data into bottom of Android StaggeredGridView and not go back top? -


i'm use staggeredgridview in project,and add data staggered grid view when scroll bottom,but grid view had go top.i not want go top.

the following onchanged method in staggeredgridview, how modify it?

please me resolve problem,thanks much!

private class adapterdatasetobserver extends datasetobserver {      private parcelable minstancestate = null;      @override     public void onchanged() {         mdatachanged = true;         mitemcount = madapter.getcount();       // todo: consider matching these if have stable ids.         mrecycler.cleartransientviews();          if (mhasstableids) {             // clear layout records , recycle views             mlayoutrecords.clear();             recycleallviews();              // reset item bottoms equal item tops             final int colcount = mcolcount;             (int = 0; < colcount; i++) {                 mitembottoms[i] = mitemtops[i];             }         }          // reset list if position not exist or id position has changed         if(mfirstposition > mitemcount-1 || madapter.getitemid(mfirstposition) != mfirstadapterid){             mfirstposition = 0;             arrays.fill(mitemtops, 0);             arrays.fill(mitembottoms, 0);              if(mrestoreoffsets!=null)             arrays.fill(mrestoreoffsets, 0);         }          // todo: consider repopulating in deferred runnable instead         // (so successive changes may still batched)         requestlayout();     }      @override     public void oninvalidated() {     } } 

i have found method resolve problem remove following code:

// reset list if position not exist or id position has changed     if(mfirstposition > mitemcount-1 || madapter.getitemid(mfirstposition) != mfirstadapterid){         mfirstposition = 0;         arrays.fill(mitemtops, 0);         arrays.fill(mitembottoms, 0);          if(mrestoreoffsets!=null)         arrays.fill(mrestoreoffsets, 0);     }  


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -