【发布时间】:2019-12-03 10:47:01
【问题描述】:
我正在尝试结合缩放和平移动画,但这些动画之后的图像是碎片化的
动画
//TODO: **Translate**
val animatorLogoLoginTransaction = ObjectAnimator.ofFloat(
logoLogin,
View.TRANSLATION_Y,
-logoStateTopValue
)
animatorLogoLoginTransaction.startDelay = 500
animatorLogoLoginTransaction.duration = 1000
animatorLogoLoginTransaction.start()
//TODO: **Scale**
val scalaAnimation = val scalaAnimation = ScaleAnimation(1f,0.4f,1f,0.4f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f)
scalaAnimation.fillAfter = true
scalaAnimation.duration = 1000
logoLogin.startAnimation(scalaAnimation)
我的图像视图的 XML
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/logoLogin"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:scaleType="fitStart"
android:layout_marginStart="16dp"
android:src="@drawable/vree_logo_large"
app:layout_constraintTop_toTopOf="@id/limitGuideLogo"
app:layout_constraintLeft_toLeftOf="parent"/>
【问题讨论】:
-
查看我的更新答案。希望它会帮助你。如果它适合您,请考虑接受。
标签: android xml animation kotlin scale