华为动画比其他手机快很多

问题描述 投票:0回答:1

我想为我的应用添加加载动画。彼此相邻的两个点交替闪烁(类似于铁路交叉口灯)。它在其他手机上也可以正常工作,但是华为的动画持续时间有些问题,并且这两个点的动画越来越不同步,突然之间它们开始同时闪烁。

以前有人遇到过这个问题吗?我可以确认我已经在Razer Phone 2,小米Mi A1和三星Galaxy S7上对其进行了测试,并且工作正常且没有故障。只是华为手机有这个问题。另外,华为Android版本与小米Mi A1版本相同,因此与版本无关。

代码:

                val anim1 = ObjectAnimator.ofFloat(dotAnimView1, View.ALPHA, 1f, 0f).apply {
                    duration = 900
                    repeatMode = ValueAnimator.REVERSE
                    repeatCount = Animation.INFINITE
                }
                val anim2 = ObjectAnimator.ofFloat(dotAnimView2, View.ALPHA, 1f, 0f).apply {
                    duration = 900
                    repeatMode = ValueAnimator.REVERSE
                    repeatCount = Animation.INFINITE
                }
                if((anim1?.isRunning == false || anim2?.isRunning == false)){
                    anim1.start()
                    post(900){ anim2.start() }
                }
android android-animation
1个回答
0
投票

检查开发人员选项->动画师持续时间比例。如果将其设置为0.5x或“关闭动画”,则可能会遇到这种奇怪的情况。如果是这种情况,请尝试将其设置为默认值1x。

© www.soinside.com 2019 - 2024. All rights reserved.