Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 设置动画时未调整MotionLayout的大小_Android_Android Layout_Android Motionlayout - Fatal编程技术网

Android 设置动画时未调整MotionLayout的大小

Android 设置动画时未调整MotionLayout的大小,android,android-layout,android-motionlayout,Android,Android Layout,Android Motionlayout,我有这样的看法: <androidx.constraintlayout.motion.widget.MotionLayout android:id="@+id/expandableModes" android:layout_width="200dp" android:layout_height="200dp"

我有这样的看法:

<androidx.constraintlayout.motion.widget.MotionLayout
                    android:id="@+id/expandableModes"
                    android:layout_width="200dp"
                    android:layout_height="200dp"
                    android:paddingBottom="5dp"
                    app:layoutDescription="@xml/journey_motion"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="@id/guidelineLeft"
                    app:layout_constraintTop_toBottomOf="@id/travelModeText">
    ....
    </androidx.constraintlayout.motion.widget.MotionLayout>

我的动画已播放,但我的视图未调整大小,我错过了什么?

您正在尝试为运动布局本身设置动画。只能按以下说明设置直接子对象的动画:


您需要创建视图的子视图并设置动画。

您正在尝试设置运动布局本身的动画。只能按以下说明设置直接子对象的动画:

您需要创建视图的子视图并设置动画

<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <Transition
        app:constraintSetEnd="@id/endExpand"
        app:constraintSetStart="@id/startExpand"
        app:duration="1000" />
    <ConstraintSet android:id="@+id/startExpand">
        <Constraint
            android:id="@id/expandableModes"
            android:layout_width="200dp"
            android:layout_height="200dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@id/guidelineLeft"
            app:layout_constraintTop_toBottomOf="@id/travelModeText" />
    </ConstraintSet>
    <ConstraintSet android:id="@+id/endExpand">
        <Constraint
            android:id="@id/expandableModes"
            android:layout_width="10dp"
            android:layout_height="10dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@id/guidelineLeft"
            app:layout_constraintTop_toBottomOf="@id/travelModeText" />
    </ConstraintSet>
</MotionScene>
binding.expandableModes.transitionToEnd {
                        print("")
                    }