Advertisement

Responsive Advertisement

Sticky header in recyclerview or Lazycolumn or LazyRow in Jetpack compose

  •  Step 1 :-

    private val sectionsList by lazy {
    listOf("A", "B", "C", "D", "E")
    }

  • Step 2 :-

    sectionsList.forEach { section ->
    stickyHeader {
    Text(
    modifier = Modifier
    .fillMaxWidth()
    .background(Color.LightGray)
    .padding(12.dp),
    text = "Section $section"
    )
    }
    items(personList) {person->

    CustomItem(person)

    }
    }
  • Step 3 :-

    Screenshot :-




Post a Comment

0 Comments