VegaLayoutManager icon indicating copy to clipboard operation
VegaLayoutManager copied to clipboard

很强大的库,感谢分享,能不能扩展下呢

Open thundeGG opened this issue 7 years ago • 9 comments

比如可以跟LinearLayoutMangear一样往上滑,但是当前显示的第一个item跟现在一样缩小

thundeGG avatar Oct 27 '17 09:10 thundeGG

这个。。怕是需要后来人来扩展了

xmuSistone avatar Oct 27 '17 09:10 xmuSistone

/** * 计算可滑动的最大值 */ private void computeMaxScroll() { maxScroll = locationRects.get(locationRects.size() - 1).bottom - getHeight(); if (maxScroll < 0) { maxScroll = 0; return; }

    int itemCount = getItemCount();
    int screenFilledHeight = 0;
    for (int i = itemCount - 1; i >= 0; i--) {
        Rect rect = locationRects.get(i);
        screenFilledHeight = screenFilledHeight + (rect.bottom - rect.top);
        if (screenFilledHeight > getHeight()) {
            int extraSnapHeight = getHeight() - (screenFilledHeight - (rect.bottom - rect.top));
            maxScroll = maxScroll + extraSnapHeight;
            break;
        }
    }
}

这块我想让它的最大滑动距离到Recyclerview的底部就不能滑,该怎么改 TAT

thundeGG avatar Oct 27 '17 11:10 thundeGG

@7hundeR 你这样改,是可以的。最大滑动到底部,如果达不到snap的要求,snap在最后一个item便不工作了。

xmuSistone avatar Oct 28 '17 01:10 xmuSistone

改了半天还是没太明白你这个maxScroll 是怎么算的 TAT

thundeGG avatar Oct 28 '17 03:10 thundeGG

代码设计是你在绑定Adapter或者notifyChange的时候,每一个item的位置、高度,都给你计算好并保存到rect中。maxScroll就是你最大滑动的值。只需要通过最后一个view对应的rect就可以算出来。

xmuSistone avatar Oct 28 '17 03:10 xmuSistone

最后一个view对应的rect的bottom值吗

thundeGG avatar Oct 28 '17 03:10 thundeGG

亲,我又来了,能扩展成横向的吗😂😂

thundeGG avatar Jan 11 '18 07:01 thundeGG

you can see https://github.com/Victor2018/VegaLayoutManager support horizontal & vertical scroll by kotlin

Victor2018 avatar Jul 27 '23 08:07 Victor2018

亲,我又来了,能扩展成横向的吗😂😂

you can see https://github.com/Victor2018/VegaLayoutManager support horizontal & vertical scroll by kotlin

Victor2018 avatar Jul 27 '23 08:07 Victor2018