Suman Radhakrishnan
Suman Radhakrishnan

Reputation: 668

How to set delay time to List adapter default animation

Every thing in List Adapter Works fine. But I want to set delay time while it doing its default animation. It was like super speed. But I need set a delay of 500L

Consider a Page that has Edittext and Recyclerview. When the page open everything works fine. But when user typed any words in Edit Text filter process takes place. After filter I update the list by following code

someAdapter.apply {
   submitList(someList.toList())
}

Problem is default animation of List adaper is super speed.

Upvotes: 0

Views: 695

Answers (2)

MrLittle
MrLittle

Reputation: 81

You can edit the following parameters in the recyclerView class:

init {
    itemAnimator!!.changeDuration = 2000L  //default value: 250 
    itemAnimator!!.addDuration = 2000L  //default value: 120
    itemAnimator!!.moveDuration = 2000L  //default value: 250
    itemAnimator!!.removeDuration = 2000L  //default value: 120
}

Upvotes: 0

Vinayak Moger
Vinayak Moger

Reputation: 120

recyclerview.itemAnimator!!.changeDuration = 2000L

Upvotes: 3

Related Questions