首页 > RecyclerView更新数据后,如何自动定位到最底部?

RecyclerView更新数据后,如何自动定位到最底部?

在ListView里有setSelection可以用,但是在RecyclerView里似乎没有?


二楼太给力了


我来回答完美解决方案吧:
第一种方法:

mRecycleView.smoothScrollBy(distance,duration);

第二种方法:

mRecycleView.smoothScrollOffset(offset);

第三种方法:

mRecycleView.smoothToPosition(index);

以上三种方法都可以,希望对题注有帮助


没有,但还有scrollToPosition(int position)啊


recyclerView.scrollToPosition(getAdapter().getItemCount()-1);


二楼的回答那么给力


LinearLayoutManager linearLayoutManager = new LinearLayoutManager();
linearLayoutManager.setStackFromEnd(true);
recyclerView.setLayoutManager(linearLayoutManager);
【热门文章】
【热门文章】