Comments (1)
需求:在点击粘性标签后,刷新对应标签的UI。
异常现象:当列表中的粘性标签只有一个时,可以刷新标签UI,如果有多个粘性标签时,就不能正常刷新UI。
原因: 粘性标签显示时,需要通过adapter创建或复用一个粘性标签,此时通过position可以获取对应的holder,而在源码中ClickBounds类设置view的时候,同一个View id(除了holder.itemView) 只会设置一次。所以,在标签更新后,view没有重新设置。而点击事件是根据view所在区域进行判断和回调的,并不是对应的View真正的点击事件。
源码如下:
public void setClickBounds(int id, View view) { ClickBounds bounds; if (mBoundsArray.get(id) == null) { bounds = new ClickBounds(view, view.getLeft(), view.getTop(), view.getLeft() + view.getMeasuredWidth(), view.getTop() + view.getMeasuredHeight()); mBoundsArray.put(id, bounds); } else { bounds = mBoundsArray.get(id); bounds.setBounds( view.getLeft(), view.getTop(), view.getLeft() + view.getMeasuredWidth(), view.getTop() + view.getMeasuredHeight()); } }
解决: 在如上代码中,应该在mBoundsArray.get(id) != null的情况下也将view设置到bounds对象中,这样就可以了。
感谢楼主写的标签库,功能很好,简单易用。
from pinnedsectionitemdecoration.
Related Issues (20)
- bug in android support 28.0.0 HOT 4
- 吸顶tab切换 HOT 2
- 每次刷新数据的时候,上面的悬停view会挡住第一行,请问下怎么解决呢 HOT 1
- 配合XRecycleView使用会出现粘性头部和实际数据位置不符的问题
- 设置divider比较宽的时候,最左边第一张图片宽度被压缩,比同行的另外几张窄
- 与databinding 使用 文字不显示
- Header根布局必须使用FrameLayout否则设置背景色无效
- java.lang.ClassCastException: android.widget.FrameLayout cannot be cast to android.widget.TextView
- 设置吸顶decoration,出现如图问题 HOT 1
- ItemDecoration标签点击事件异常(标签布局中部分子View点击事件不生效)
- ![image](https://user-images.githubusercontent.com/6427399/60393522-45f34700-9b49-11e9-821b-94409c372b17.png)
- 滑动的时候 Rv的srcollbar 的高度会一直变化,一会长一会短 这个有办法处理吗?
- 怎么设置分割线的大小 HOT 1
- RecyclerView的clipToPadding="false"属性不生效
- 怎样实现增量插入更新到对应的组内
- 当悬浮view有网络图片时 加载空白 可能是还没有加载完成时,已经好创建了view
- 自适应宽高的瀑布流
- jcenter 即将于五月一日关停. 可以将库上传到 jitpack.io 之类的地方吗 HOT 1
- header item layout 中 有自定义View 悬浮时不显示
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pinnedsectionitemdecoration.