在某些设备中更改scalex和scaley时,Android MotionLayout会使应用程序滞后

在某些设备中更改scalex和scaley时,Android MotionLayout会使应用程序滞后,android,animation,android-motionlayout,Android,Animation,Android Motionlayout,我正在我的项目中使用运动布局,这里是最终结果 它看起来正常,但是动画在某些设备中播放滞后 动画在旧设备(三星j5 2016和三星j5 2017以及HTC desire 820)中使用滞后播放 这是一个旧设备记录: 动画在模拟器和新设备(华为p30 light)中运行良好& 三星(注8) 在布局说明中,scaleX和scaleY和alpha正在更改 这是我的布局描述源代码 <?xml version="1.0" encoding="utf-8"

我正在我的项目中使用运动布局,这里是最终结果

它看起来正常,但是动画在某些设备中播放滞后

  • 动画设备(三星j5 2016和三星j5 2017以及HTC desire 820)中使用滞后播放
    这是一个旧设备记录:
  • 动画模拟器新设备(华为p30 light)中运行良好& 三星(注8)

布局说明
中,
scaleX
scaleY
alpha
正在更改

这是我的布局描述源代码

<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:motion="http://schemas.android.com/apk/res-auto">

    <Transition
        motion:constraintSetStart="@+id/start"
        motion:constraintSetEnd="@+id/end"
        motion:duration="1000"/>

    <ConstraintSet android:id="@+id/start">

        <Constraint
            android:id="@id/mock_view"
            android:layout_width="0dp"
            android:layout_height="0dp"
            motion:layout_constraintEnd_toEndOf="parent"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintBottom_toBottomOf="parent"/>

        <Constraint
            android:id="@id/cv_content"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:rotation="0"
            android:alpha="1"
            motion:layout_constraintRight_toLeftOf="@+id/button"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintWidth_default="percent"/>

        <Constraint
            android:id="@id/content"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:rotation="0"
            motion:layout_constraintRight_toLeftOf="@+id/button"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintWidth_default="percent"/>


        <Constraint
            android:id="@id/v_activity_main_content"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            motion:layout_constraintEnd_toEndOf="parent"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintBottom_toBottomOf="parent"
            motion:layout_constraintStart_toEndOf="parent"/>

        <Constraint
            android:id="@id/cv_content_shadow"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:alpha="0"
            motion:layout_constraintRight_toRightOf="@+id/content_space"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintWidth_default="percent"
            motion:layout_constraintWidth_percent="1" />

        <Constraint
            android:id="@id/content_shadow"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:alpha="0"
            motion:layout_constraintRight_toRightOf="@+id/content_space"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintWidth_default="percent"
            motion:layout_constraintWidth_percent="1" />

    </ConstraintSet>

    <ConstraintSet android:id="@+id/end">

        <Constraint
            android:id="@id/mock_view"
            motion:layout_constraintWidth_default="percent"
            motion:layout_constraintWidth_percent="0.6"
            android:layout_height="0dp"
            motion:layout_constraintEnd_toEndOf="parent"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintBottom_toBottomOf="parent"/>

        <Constraint
            android:id="@id/cv_content"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:rotation="0"
            android:scaleX="0.72"
            android:scaleY="0.75"
            android:alpha="1"
            motion:layout_constraintRight_toLeftOf="@+id/button"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintWidth_default="percent"
            motion:layout_constraintWidth_percent="1" />

        <Constraint
            android:id="@id/content"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:rotation="0"
            android:scaleX="0.72"
            android:scaleY="0.72"
            motion:layout_constraintRight_toLeftOf="@+id/button"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintWidth_default="percent"
            motion:layout_constraintWidth_percent="1" />

        <Constraint
            android:id="@id/cv_content_shadow"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:scaleX="0.62"
            android:scaleY="0.65"
            android:alpha="0.3"
            motion:layout_constraintRight_toRightOf="@+id/content_space"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintWidth_default="percent"
            motion:layout_constraintWidth_percent="1" />

        <Constraint
            android:id="@id/content_shadow"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:scaleX="0.62"
            android:scaleY="0.62"
            android:alpha="0.3"
            motion:layout_constraintRight_toRightOf="@+id/content_space"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintWidth_default="percent"
            motion:layout_constraintWidth_percent="1" />

        <Constraint
            android:id="@id/v_activity_main_content"
            android:layout_width="0dp"
            android:scaleX="0.75"
            android:scaleY="0.75"
            android:layout_height="match_parent"
            motion:layout_constraintRight_toLeftOf="@+id/button"
            motion:layout_constraintTop_toTopOf="parent"
            motion:layout_constraintWidth_default="percent"
            motion:layout_constraintWidth_percent="1"/>

    </ConstraintSet>

</MotionScene>

请问制作动画时有没有什么帮助?

这里再次说明,当动画开始时,它已经滞后了

我没有找到任何解决方案,现在,我正在使用
ObjectAnimator
,它解决了我的问题。但是,我的问题是,为什么
Motionlayout
在旧设备中落后,我也有同样的问题。在我的牛轧糖装置上,无论我尝试了什么,动画都非常不稳定。我在运行android 9的设备上安装了相同的应用程序,动画非常流畅。