Android 如何使用水平线性布局管理器滚动TopoPosition RecyclerView
此代码按预期工作:Android 如何使用水平线性布局管理器滚动TopoPosition RecyclerView,android,android-recyclerview,horizontal-scrolling,linearlayoutmanager,Android,Android Recyclerview,Horizontal Scrolling,Linearlayoutmanager,此代码按预期工作: LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false); mRecyclerView.setLayoutManager(layoutManager); mRecyclerView.scrollToPosition(2); 定位和滚动是垂直的,显示第三项 现在,如果在上述代码中,将
LinearLayoutManager layoutManager = new LinearLayoutManager(this,
LinearLayoutManager.VERTICAL, false);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.scrollToPosition(2);
定位和滚动是垂直的,显示第三项
现在,如果在上述代码中,将垂直替换为水平时,项目将水平显示,滚动是水平的(如预期),但是设置滚动位置(2)
不再起作用
如何使用水平线布局管理器滚动位置
我的XML文件如下所述:
< android.support.v7.widget.RecyclerView
android:id="@+id/rvPosters"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:paddingBottom="4dp" >
您不能完全看到第三项?您不能完全看到第三项吗?