- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在为这两种情况寻找一个实际的例子,什么时候使用?我见过类似的线程,但它们只告诉这个“ 必须立即执行绑定(bind) ”,但是对于必须强制执行绑定(bind)的任何情况,都没有实时示例。所以请如果有人可以用任何例子解释什么时候使用它,什么时候不需要它!
最佳答案
应该使用 executePendingBindings()
的情况是(但可能还有更多):
Every time the binding update could cause a View to change its size and postponing the calculation in the next frame could cause the measurement to read wrong values.
RecyclerView
,如果发生这种情况:
viewType
不同大小的s(不同的XML)RecyclerView
将在
onBindViewHolder
之后测量行大小已完成。如果根据您在此方法中设置的数据,行高发生变化,如果您不调用
executePendingBindings()
,则测量无法考虑新内容占用的额外或减少空间。 .
关于android - 何时使用 executePendingBindings() 何时不需要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58678913/
最近我一直在使用数据绑定(bind),我遇到了 executePendingBindings方法。 文档没有说太多,所以我不明白它是如何工作的或何时使用它。这是该方法的使用示例。 请举一个例子来说明使
我正在为这两种情况寻找一个实际的例子,什么时候使用?我见过类似的线程,但它们只告诉这个“ 必须立即执行绑定(bind) ”,但是对于必须强制执行绑定(bind)的任何情况,都没有实时示例。所以请如果有
我最近一直在使用数据绑定(bind),并且遇到了 executePendingBindings 方法。该文档几乎没有显示它,我不明白它是如何工作的或何时使用它。 许多开发人员在 onBindViewH
我是一名优秀的程序员,十分优秀!