-4

recyclerView =findViewById<RecyclerView>(R.id.demo_recyclerview).apply {

            setHasFixedSize(true)


            layoutManager = viewManager


            adapter = demoAdapter

        }

回收站视图中的错误(未解决的参考)

4

1 回答 1

0

你必须先膨胀视图。就像是

val view = LayoutInflater.from(context).inflate(R.fragment_contacts, null)

然后您可以在此视图中找到您的回收站视图:

recyclerView = view.findViewById<RecyclerView>(R.id.demo_recyclerview).apply {

            setHasFixedSize(true)


            layoutManager = viewManager


            adapter = demoAdapter

        }
于 2019-07-28T08:52:14.583 回答