alibaba / vlayout

Project vlayout is a powerfull LayoutManager extension for RecyclerView, it provides a group of layouts for RecyclerView. Make it able to handle a complicate situation when grid, list and other layouts in the same recyclerview.
http://tangram.pingguohe.net/
MIT License
10.8k stars 1.79k forks source link

onViewDetachedFromWindow不回调! #443

Closed Cedar-byte closed 5 years ago

Cedar-byte commented 5 years ago

当position==0的时候,onViewDetachedFromWindow和onViewAttachedToWindow都不回调,而当position > 0的时候就没问题。用的vlayout版本是1.3.0。 我点进1.3.0的源码进去后发现

@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
    super.onViewDetachedFromWindow(holder);
    int position = holder.getPosition();
    if (position > 0) {
        Pair<AdapterDataObserver, Adapter> pair = findAdapterByPosition(position);
        if (pair != null) {
            pair.second.onViewDetachedFromWindow(holder);
        }
    }
}

这里面条件是>0......... 不想导线下lib啊,想问啥时候更新发版啊。。。

Cedar-byte commented 5 years ago

好吧,我找到办法了,版本换成1.2.23就没问题了,1.2.23中的判断条件是>=0,看来以后mvnrepository中找版本号得根据最后面的日期来。