其他分享
首页 > 其他分享> > Android实现扫描二维码动画效果

Android实现扫描二维码动画效果

作者:互联网

如图:

 

中心的线在从上到下的动画效果

代码实现:

 private fun initAnimation() {
        val mAnimation = TranslateAnimation(TranslateAnimation.ABSOLUTE, 0f, TranslateAnimation.ABSOLUTE,0f, TranslateAnimation.RELATIVE_TO_PARENT, 0f,
            TranslateAnimation.RELATIVE_TO_PARENT, 0.9f)
        mAnimation.duration = 1500
        mAnimation.repeatCount = -1
        mAnimation.repeatMode = Animation.RESTART
        mAnimation.interpolator = LinearInterpolator()
        binding.imgLine.animation = mAnimation

    }

  

 

 

完成

 

 

参考于:https://blog.csdn.net/lindonghai/article/details/80775775

 

标签:动画,PARENT,TranslateAnimation,RELATIVE,二维码,0f,Android,ABSOLUTE,mAnimation
来源: https://www.cnblogs.com/changyiqiang/p/15893185.html