我在Constraint Layout中有一个TextView.我试图以视图从顶部离开屏幕的方式进行动画制作.这是我到目前为止所做的,
ConstraintSet constraintSet = new ConstraintSet();
ConstraintLayout layout = (ConstraintLayout)holder.mView;
constraintSet.clone(layout);
constraintSet.clear(R.id.txt_PackageTitle,ConstraintSet.TOP);
constraintSet.clear(R.id.txt_PackageDescription,ConstraintSet.TOP);
constraintSet.clear(R.id.txt_PackageTitle,ConstraintSet.BOTTOM);
constraintSet.clear(R.id.txt_PackageDescription,ConstraintSet.BOTTOM);
constraintSet.setMargin(R.id.txt_PackageTitle,ConstraintSet.TOP,-600);
constraintSet.setMargin(R.id.txt_PackageDescription,ConstraintSet.TOP,-1200);
ChangeBounds transition = new ChangeBounds();
transition.setInterpolator(new BounceInterpolator());
transition.setDuration(600);
TransitionManager.beginDelayedTransition(layout,transition);
constraintSet.applyTo(layout);
现在这段代码只将内容移动到视图的顶部,它不会离开视图并消失.
如何使用约束布局执行此操作?