GcsSloop / pager-layoutmanager

[暂停维护]Android 网格分页布局。
http://www.gcssloop.com/
Apache License 2.0
1.13k stars 182 forks source link

notifyItemChanged 失效,无法刷新单条数据 #22

Open HateTomatoes opened 6 years ago

HateTomatoes commented 6 years ago

notifyDataSetChanged是有效的,也就是做不到刷新单个item。 如果只是刷新数据,可以使用LiveData实现。但是,如果TextView的宽度是wrapcontent,字符长度变化的时候由于控件没刷新,所以就会出现字符被切掉的问题。

tanranran commented 6 years ago

+1

yongchao1210 commented 5 years ago

+1

tranleo148 commented 5 years ago

+1 i have the same issue

NoahZu commented 5 years ago

+1

huihui4045 commented 4 years ago

+1

dingpengqiang commented 4 years ago

+1

JohnsCui commented 3 years ago

怎么利用livedata更新某个item?

duanfb commented 2 years ago

PagerGridLayoutManager中onLayoutChildren把if (state.isPreLayout() || !state.didStructureChange()) 改为只需要判断: if (state.isPreLayout()) { return; }

第一页闪烁问题,同样onLayoutChildren中: //解决第一页刷新闪烁问题 // if (mOffsetX == 0 && mOffsetY == 0) { // // 预存储View // for (int i = 0; i < mOnePageSize; i++) { // if (i >= getItemCount()) break; // 防止数据过少时导致数组越界异常 // View view = recycler.getViewForPosition(i); // addView(view); // measureChildWithMargins(view, mWidthUsed, mHeightUsed); // } // }