How to get child view from RecyclerView?

前端 未结 11 1928
离开以前
离开以前 2020-12-24 08:18

I am trying to get child view by position. I could get view when one item is clicked:

rvSellRecords.addOnItemTouchListener(new RecyclerItemClickListener(         


        
11条回答
  •  既然无缘
    2020-12-24 09:09

    Hope this helps someone: I was getting null pointer exceptions with:

    • recyclerView.findViewHolderForAdapterPosition
    • recyclerView.findViewHolderForItemId
    • layoutManager.findViewByPosition.

    The reason was that there is a slight delay for the viewholder to be created. I found the solution here: https://stackoverflow.com/a/33414430/7952427

提交回复
热议问题