如何从Android中RecyclerView适配器获得项目适配器、项目、Android、RecyclerView

由网友(唐尸三摆手)分享简介:在旧的code当我使用自定义的ListView适配器我可以用这个code拿到项目。In old code when I was using ListView with custom adapter I could get item with this code.Message msg = (Message) ada...

在旧的code当我使用自定义的ListView适配器我可以用这个code拿到项目。

In old code when I was using ListView with custom adapter I could get item with this code.

Message msg = (Message) adapter.getItem(poistion);

现在我实现RecyclerView。如何从RecyclerView适配器得到项目?

Now I am implementing RecyclerView. How can I get item from RecyclerView adapter?

推荐答案

您必须自己实现它。

在自定义适配器添加了新的方法和你做。

Add a new method in your custom Adapter and you are done.

public Message getItem(int position) {
  return messageList.get(position);
}
阅读全文

相关推荐

最新文章