xiangcman / LayoutManager-FlowLayout

快速利用RecyclerView的LayoutManager搭建流式布局
675 stars 157 forks source link

加载10000条数据 #27

Open Allen-cxl opened 5 years ago

Allen-cxl commented 5 years ago

加载10000条数据,App直接ANR了。有什么办法解决的吗?

xiangcman commented 5 years ago

你把发生Anr的日志发给我

发自我的 iPhone

在 2019年4月18日,20:28,Allen-cxl notifications@github.com 写道:

加载10000条数据,App直接ANR了。有什么办法解决的吗?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Allen-cxl commented 5 years ago

后来我重新看了下,又没有出现anr。出现了下面问题: 1.空指针crash 2.上下快速滑动会卡顿,布局会重叠 java.lang.NullPointerException: Attempt to read from field 'int android.graphics.Rect.bottom' on a null object reference at com.test.toastdemo.FlowLayoutManager.fill(FlowLayoutManager.java:191) at com.test.toastdemo.FlowLayoutManager.scrollVerticallyBy(FlowLayoutManager.java:241) at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4680)

代码片段: RecyclerView.setLayoutManager(new FlowLayoutManager()); RecyclerView.setAdapter(new RecycleViewAdapter(this, Data.foods())); public static List foods(){ List foods =new ArrayList<>(); Data food = null; for (int i = 0 ; i < 10000 ; i++){ food = new Data("recycle"+"("+i+")"); foods.add(food); } return foods; }

xiangcman commented 5 years ago

具体加我qq吧 或者加群 1002326270

发自我的 iPhone

在 2019年4月26日,10:10,Allen-cxl notifications@github.com 写道:

后来我重新看了下,又没有出现anr。出现了下面问题: 1.空指针crash 2.上下快速滑动会卡顿,布局会重叠 java.lang.NullPointerException: Attempt to read from field 'int android.graphics.Rect.bottom' on a null object reference at com.test.toastdemo.FlowLayoutManager.fill(FlowLayoutManager.java:191) at com.test.toastdemo.FlowLayoutManager.scrollVerticallyBy(FlowLayoutManager.java:241) at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:4680)

代码片段: RecyclerView.setLayoutManager(new FlowLayoutManager()); RecyclerView.setAdapter(new RecycleViewAdapter(this, Data.foods())); public static List foods(){ List foods =new ArrayList<>(); Data food = null; for (int i = 0 ; i < 10000 ; i++){ food = new Data("recycle"+"("+i+")"); foods.add(food); } return foods; }

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.