Git Product home page Git Product logo

Comments (15)

youlookwhat avatar youlookwhat commented on May 31, 2024 1

好的 可以了就行哈

from byrecyclerview.

youlookwhat avatar youlookwhat commented on May 31, 2024

头部的appBarLayout可以使用appBarLayout.setExpanded(true);

这个是展开的操作,看是否符合你的需求

from byrecyclerview.

youlookwhat avatar youlookwhat commented on May 31, 2024

可以监听recyclerView,处于停止的时候再执行appBarLayout.setExpanded(true);

recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
            }

            @Override
            public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
                    appBarLayout.setExpanded(true);
                }
            }
        });

也是需要执行scrollToPosition(0),或者是recyclerView.smoothScrollToPosition(0);

from byrecyclerview.

Lancerer avatar Lancerer commented on May 31, 2024

这个问题解决了我先把PersistentRecyclerView scrollToposition(0) 然后设置appBarLayout的topAndBottomOffset为0这样可以到达顶部然后进行刷新

from byrecyclerview.

Lancerer avatar Lancerer commented on May 31, 2024

但是现在有一个新的问题,内部的PersistentRecyclerView 他的item又有一个recyclerView,这个recyclerView不但会和PersistentRecyclerView 滑动冲突,我重写了item中的recyclerView的dispatchTouchEvent,内部拦截,但是他好像和appBarLayout又有冲突

from byrecyclerview.

youlookwhat avatar youlookwhat commented on May 31, 2024

一般是建议是item不要有recyclerView,有的话应该也是要设置一个横向的recyclerView,如果是纵向的本身就会有问题。
如果是横向的我还有解决方式,我们之前的项目中有处理横向的情况。

from byrecyclerview.

Lancerer avatar Lancerer commented on May 31, 2024

项目要求这样实现没办法,大佬有解决办法吗。。。现在的现象是AppBarLayout收缩吸顶的情况下PersistentRecyclerView 还没有滑动到顶部,这个是滑动item的recyclerView时,会直接把appBarLayout拉下来,

from byrecyclerview.

youlookwhat avatar youlookwhat commented on May 31, 2024

你可以将纵向的recyclerView可以设置为横向的呀,将纵向的条数作为span处理,能理解吗

from byrecyclerview.

Lancerer avatar Lancerer commented on May 31, 2024

没有太明白你说的转换成横向span处理是什么意思,我这个item的recyclerView纵向用于显示台词就一个textview

from byrecyclerview.

youlookwhat avatar youlookwhat commented on May 31, 2024

你设置成横向的recyclerView,横向的行数有[list.size],列数只有一列,可行吗

from byrecyclerview.

Lancerer avatar Lancerer commented on May 31, 2024

不行啊,他必须要纵向滚动,感谢大佬的指导,我再试试能不能解决内部item的recyclerView和最外部的appBarLayout的冲突

from byrecyclerview.

youlookwhat avatar youlookwhat commented on May 31, 2024

好的哈

from byrecyclerview.

Lancerer avatar Lancerer commented on May 31, 2024

大佬我在内部recyclerView嵌套的item中的recyclerView设置了isNestedScrollingEnabled=false这个冲突就解决了,但是不知道原因是什么

from byrecyclerview.

youlookwhat avatar youlookwhat commented on May 31, 2024

感觉是rv通过isNestedScrollingEnabled=false这个属性做了处理,解决了就好哈

from byrecyclerview.

youlookwhat avatar youlookwhat commented on May 31, 2024

感觉是rv通过isNestedScrollingEnabled=false这个属性做了处理,解决了就好哈

from byrecyclerview.

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.