diff --git a/lib_base/src/main/java/com/android/base/utils/android/views/RecyclerVIewEx.kt b/lib_base/src/main/java/com/android/base/utils/android/views/RecyclerVIewEx.kt new file mode 100644 index 0000000..a5495f9 --- /dev/null +++ b/lib_base/src/main/java/com/android/base/utils/android/views/RecyclerVIewEx.kt @@ -0,0 +1,19 @@ +package com.android.base.utils.android.views + +import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.SimpleItemAnimator + +/** + * 关闭默认局部刷新动画,对性能要求高的地方试用,比如一些公屏等刷新频繁的 + */ +fun RecyclerView.closeDefaultAnimator() { + itemAnimator?.let { + it.addDuration = 0 + it.changeDuration = 0 + it.moveDuration = 0 + it.removeDuration = 0 + if (it is SimpleItemAnimator) { + it.supportsChangeAnimations = false + } + } +} \ No newline at end of file