DBILITY

안드로이드 recyclerView scroll 본문

android/kotlin

안드로이드 recyclerView scroll

DBILITY 2024. 3. 11. 16:22
반응형
private val smoothScroller: SmoothScroller by lazy {
    object : LinearSmoothScroller(binding.root.context) {
        override fun getVerticalSnapPreference(): Int {
            return SNAP_TO_START
        }
    }
}
    
activityMainRecyclerView.apply {
    layoutManager = LinearLayoutManager(root.context)
    layoutManager?.apply {
        smoothScroller.targetPosition = viewModel.items.value.size-1
        startSmoothScroll(smoothScroller)
    }
    itemAnimator = null
    adapter = todoListAdapter
}

 

반응형
Comments