1

I want to add a section header or something to state its a new section but I just can't get it right. The testSection.setHeader() method I commented out requires an item called Header : Group.

This is the code for the recycler view:

private fun updateRecyclerViewTest(items: List<Item>) {
    fun init() {
        recycler_view_test.apply {
            layoutManager = LinearLayoutManager(this@EditModActivity)
            adapter = GroupAdapter<ViewHolder>().apply {
                testSection = Section(items)
                assSection = Section(items)
                //pracSection = Section(items)
                add(testSection)
                add(assSection)
                //add(pracSection)
                setOnItemClickListener(onItemClick)
            }
        }
        shouldInitRecyclerView = false
    }
    if (shouldInitRecyclerView)
        init()
    else
    {

        testSection.update(items.subList(0,3))
        //testSection.setHeader()
        assSection.update(items.subList(4,6))
        //pracSection.update(items.subList(6,9))
    }
}

This is the current output

output

pfx
  • 20,323
  • 43
  • 37
  • 57
Cleaven
  • 974
  • 2
  • 9
  • 30
  • See this question: https://stackoverflow.com/questions/26245139/how-to-create-recyclerview-with-multiple-view-type – Juan Sep 02 '18 at 18:24

0 Answers0