设置默认 CardView 最初显示

Set default CardView for show initially

我最近一直在使用 android CardView,据我所知,CardView 只会先显示第一张卡片,然后向下滑动后才能看到其他卡片。

我的问题是:我们如何才能设置默认 CardView 初始值?

例如

显示屏会在中间特定位置显示一张卡片,您可以滑动查看其他卡片。

如果您想在开始时显示特定项目,请使用 RecyclerViewscrollToPosition();

RecyclerView rv=.......
rv.scrollToPosition(2); //position of card view

参见 this

it is a convenience method to scroll to a certain position. RecyclerView does not implement scrolling logic, rather forwards the call to scrollToPosition(int)

并使用 cardview 作为您需要的元素。