Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConsecutiveScroller下的recyclyview无法滚动到recyclyview数据的第一个 #292

Open
billdizl opened this issue May 12, 2023 · 8 comments

Comments

@billdizl
Copy link

RecyclerView.scrollToPosition(0)设置无效,无法滚动到数据的第一个

@donkingliang
Copy link
Owner

使用ConsecutiveScroller的scrollToChild(recyclerView)。就是滑动到recyclerView的顶部

@billdizl
Copy link
Author

我使用了layout_isSticky 这个属性 最外层是SmartRefreshLayout, <com.scwang.smart.refresh.layout.SmartRefreshLayout>
<com.donkingliang.consecutivescroller.ConsecutiveScrollerLayout
app:isPermanent="true">
</com.donkingliang.consecutivescroller.ConsecutiveScrollerLayout>











<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rcvProduct">
</androidx.recyclerview.widget.RecyclerView>

</com.scwang.smart.refresh.layout.SmartRefreshLayout>

使用ConsecutiveScroller的scrollToChild(rcvProduct)滑动到recyclerView的顶部,会有偏差

@billdizl
Copy link
Author

期望效果
70e486e2962f6a29a39cc445f461e4ab_0
实际效果
d2ae1490f746698b13426e2dba4766e4_0

@donkingliang
Copy link
Owner

scrollToChildWithOffset可以设置滑动到顶部offset偏移量的位置

@billdizl
Copy link
Author

billdizl commented May 12, 2023

我猜想,应该是向上偏移了顶部悬停控件的高度,但是无法获取到顶部悬停控件的高度吧?

@donkingliang
Copy link
Owner

悬停控件是你自己布局里的View,怎么会获取不到高度呢。view.getHeight()就是View的高度。当然你要在页面显示之后才能获取view的高度,这个你应该知道吧

@billdizl
Copy link
Author

那我了解你的意思了,其实我是想你的控件如果有方法获取到view的高度,那就更好了,这样子还需要我动态的计算,如果有悬停控件总的高度的话,那岂不是更好,我是这么想的

@billdizl
Copy link
Author

那我具体自己实现吧,感谢~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants