Giter Site home page Giter Site logo

Comments (9)

xmuSistone avatar xmuSistone commented on July 25, 2024

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

from vegalayoutmanager.

thundeGG avatar thundeGG commented on July 25, 2024

/**
* 计算可滑动的最大值
*/
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

from vegalayoutmanager.

xmuSistone avatar xmuSistone commented on July 25, 2024

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

from vegalayoutmanager.

thundeGG avatar thundeGG commented on July 25, 2024

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

from vegalayoutmanager.

xmuSistone avatar xmuSistone commented on July 25, 2024

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

from vegalayoutmanager.

thundeGG avatar thundeGG commented on July 25, 2024

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

from vegalayoutmanager.

thundeGG avatar thundeGG commented on July 25, 2024

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

from vegalayoutmanager.

Victor2018 avatar Victor2018 commented on July 25, 2024

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

from vegalayoutmanager.

Victor2018 avatar Victor2018 commented on July 25, 2024

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

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

from vegalayoutmanager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.