Error using the RecyclerView: The specified child already has a parent

前端 未结 6 471
眼角桃花
眼角桃花 2020-12-08 13:16

I am trying to create a listView with a new RecyvlerView Adapter. I have followed the exact guide present on android developer resources. But this is giving me a strange err

6条回答
  •  既然无缘
    2020-12-08 13:30

    when inflating you shouldn't attach the view to its parent. you wrote:

    View v = inflater.inflate(R.layout.my_text_view, parent, true);
    

    which should be :

    View v = inflater.inflate(R.layout.my_text_view, parent, false);
    

提交回复
热议问题