什么情况下的回收站观相当于listview.setSelection [英] What is the equivalent listview.setSelection in case of Recycler View

查看:144
本文介绍了什么情况下的回收站观相当于listview.setSelection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在的情况下一个ListView的,如果我们想使一个特定的项目中选择我们使用setSelection的方法。我们如何做到这一点的情况下回收查看

In case of a ListView if we want to make a particular item selected we use "setSelection" method. How do we do this in case of recycler View

推荐答案

检查

scrollToPositionWithOffset(int position, int offset)
scrollToPositionWithOffset(5,0);

从LinearLayoutManager 滚动至与解决布局开始定的偏移量指定的适配器位置。

from LinearLayoutManager Scroll to the specified adapter position with the given offset from resolved layout start.

通行证,如果你想选择在顶部偏移量为0

pass offset as 0 if you want selection at top

这为我工作。

这篇关于什么情况下的回收站观相当于listview.setSelection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆