Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 a 中有一个项目列表RecyclerView,它在捏合时可以缩放,并且它目前可以很好地缩放项目,第一个列表项保持不变(最左边的那个)。
RecyclerView
我要做的是在缩放时将中心项目固定在中心。我希望RecyclerView这对我来说很容易。
如果 item 获得焦点,LinearLayoutManager 将在布局发生时保留其位置。(L-preview 不这样做,但 L 版本会有它)。如果您想保持项目中心稳定,这对您来说可能还不够,因为 LLM 将使项目参考点保持稳定。(例如,如果布局为垂直且reverseLayout 为假,则参考点是项目的顶部像素)。
作为一种解决方法,您可以在每次调整视图大小时使用适当的值调用 LLM#scrollToPositionWithOffset。