停止用户滚动到RecyclerView设置位置

编程入门 行业动态 更新时间:2024-10-19 06:21:16
本文介绍了停止用户滚动到RecyclerView设置位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所以我有一个问题,我是很新的机器人编程,它已经只有6-8个星期,因为我已经开始编程的Andr​​oid应用程序,所以我可能是盲目的,而不是见容易的答案,但这里是我的问题

so i've got a problem, i'm quite new to android programming, it's been only 6-8 weeks since i've started programming android apps so i may be blind and not see the easy answer but here's my problem:

我在做一个学校项目,我试图建立一个类似日历一个在今天的经济日历拆分视图(唯一的下方位置)

I'm making a school project and i'm trying to develop a similar calendar to the one in Today's Calendar split view (The one below here)

i.imgur/Twhpauo.png

所以我做了一个GridLayoutManager看起来像这样一个RecyclerView:

So i've made a RecyclerView with a GridLayoutManager that looks like this:

i.imgur/LyxoCzk.png

和,直到在这里一切都很好,但我想要实现,设置今天的日期的日历按钮,事情是,当我滚动了一扔,然后设置RecyclerView立场scrollToPositionWithOffset(位置, 0);视图保持从第一一扔上涨的势头,设置位置,然后不断滚动,直到动能消失

And up until here everything's fine, but i'm trying to implement the button that sets the calendar on today's date, the thing is that when i'm scrolling with a fling and then set the RecyclerView position with scrollToPositionWithOffset(position, 0); the view keeps the momentum gained from the first fling, sets the position and then keeps on scrolling until the momentum is gone

我已经搜查了很多,以找到一个解决方案,当我使用的GridView,而不是RecyclerView我用smoothScrollToPositionFromTop(),它停止滚动,然后setSelection()来定位,但在GridView跳过的帧,我不得不变化,这里RecyclerView没有smoothScrollToPositionFromTop和smoothScrollToPosition不停止滚动,同样没有scrollToPosition或scrollToPositionWithOffset。

I've searched a lot to find a solution, when i was using gridView instead of RecyclerView i used smoothScrollToPositionFromTop() which stopped the scrolling and then the setSelection() to position it, but the gridView skipped frames and i had to change, here with RecyclerView there is no smoothScrollToPositionFromTop and smoothScrollToPosition doesn't stop the scroll, neither does scrollToPosition or scrollToPositionWithOffset.

发现这个,但不利于Scroll RecyclerView显示选择项目上面

和其他许多人没有帮助。

and many others that didn't help.

我认为实现我自己的滚动逻辑,但是,当我看着它,我的头爆炸了,我不知道从哪里开始。

I considered implementing my own scrolling logic but when i looked into it my head exploded and i wouldn't know where to begin.

有谁知道如何解决这个问题?

Does anyone know how to solve this?

推荐答案

你知道吗? RecyclerView 有一个 stopScroll()方法停止滚动的进展如何?

Did you know that RecyclerView has a stopScroll() method to stop a scroll in progress?

更多推荐

停止用户滚动到RecyclerView设置位置

本文发布于:2023-10-08 01:30:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1471118.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:位置   用户   RecyclerView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!