Fix a rounding issue on Android 4.4
We can use setTranslationY directly on Android 4.4. Otherwise, we need to handle float to int routing issue very carefully.
This commit is contained in:
@@ -64,8 +64,7 @@ class MoveUpwardBehavior : CoordinatorLayout.Behavior<View> {
|
||||
|
||||
override fun onAnimationUpdate(animator: ValueAnimator) {
|
||||
val currentValue = animator.animatedValue as Float
|
||||
if (Build.VERSION.SDK_INT > 19) child.translationY = currentValue
|
||||
else ViewCompat.offsetTopAndBottom(child, (currentValue - previousValue).toInt())
|
||||
child.translationY = currentValue
|
||||
previousValue = currentValue
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user