Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.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-如何设置约束布局参数的动画?_Android_Android Animation_Android Constraintlayout - Fatal编程技术网

Android-如何设置约束布局参数的动画?

Android-如何设置约束布局参数的动画?,android,android-animation,android-constraintlayout,Android,Android Animation,Android Constraintlayout,我的布局如下所示: <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" ... <FrameLay

我的布局如下所示:

<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"

...

    <FrameLayout
            android:id="@+id/wrapper"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintHorizontal_bias=".5"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            android:padding="@dimen/glow">

        </FrameLayout>

</android.support.constraint.ConstraintLayout>
或:


没有任何成功。有人能告诉我怎么做吗?

我希望,这会对你有所帮助

ConstraintLayout.LayoutParams constraintLayoutParams = (ConstraintLayout.LayoutParams) mAvatarWrapper.getLayoutParams();
constraintLayoutParams.horizontalBias = animatedValue;
mAvatarWrapper.setLayoutParams(constraintLayoutParams);

使用
TransitionManager

  TransitionManager.beginDelayedTransition(constraintLayout)
  mAvatarWrapper.layoutParams = newParams

也适用于更改页边距等。

此处的动画在哪里?
ConstraintLayout.LayoutParams constraintLayoutParams = (ConstraintLayout.LayoutParams) mAvatarWrapper.getLayoutParams();
constraintLayoutParams.horizontalBias = animatedValue;
mAvatarWrapper.setLayoutParams(constraintLayoutParams);
  TransitionManager.beginDelayedTransition(constraintLayout)
  mAvatarWrapper.layoutParams = newParams