Getting a Reference to ViewHolder on RecyclerView Click

后端 未结 4 2067

This is my first attempt at implementing the RecyclerView. I have implemented a Callback interface between the Adapter and the V

4条回答
  •  星月不相逢
    2020-12-05 10:55

    Turn out that RecycleView saves the view position in the view layout params, so if you just want the view position from to get the right item from the list you can use this:

    RecyclerView.LayoutParams lp = (RecyclerView.LayoutParams) v.getLayoutParams();
    lp.getViewPosition();
    

提交回复
热议问题