我正在编写像画廊一样的软件,我用它来查看RecyclerView列表和更改ViewPager中的图像。我的问题是:如何在ViewPager中使用RecyclerView position?我尝试了几种不同的条件,但都不起作用。
非常感谢您抽出时间给我
@Override
public Object instantiateItem(ViewGroup container, int position) {
// Get the RecyclerView position
Intent intent = ((DetailsActivity) context).getIntent();
Bundle bundle = intent.getExtras();
int position1 = bundle.getInt("position");
String pst = String.valueOf(position1);
if (pst != null ){
position = position1;
}发布于 2018-04-18 18:18:05
获取回收器视图在其触摸事件上的位置。并使用该位置来设置视图寻呼机的位置。
步骤1>
找到你的查看器。
步骤2>
将pagerAdapter添加到视图分页中。
步骤3>
将取景页的位置设置为您获取回收站视图的位置。
viewPager.setCurrentItem(positionFromRecyclerview)https://stackoverflow.com/questions/45683359
复制相似问题