如何将当前位置传递给扩展RecyclerView.ViewHolder
的班级?它需要它才能以编程方式创建视图
答案 0 :(得分:4)
RecyclerView
持有人已拥有getAdapterPosition()
和getLayoutPosition()
方法
来自Docs:
final int getAdapterPosition()
Returns the Adapter position of the item represented by this ViewHolder.
final int getLayoutPosition()
Returns the position of the ViewHolder in terms of the latest layout pass.