Open HateTomatoes opened 6 years ago
+1
+1
+1 i have the same issue
+1
+1
+1
怎么利用livedata更新某个item?
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); // } // }
notifyDataSetChanged是有效的,也就是做不到刷新单个item。 如果只是刷新数据,可以使用LiveData实现。但是,如果TextView的宽度是wrapcontent,字符长度变化的时候由于控件没刷新,所以就会出现字符被切掉的问题。