Layout XML 2벌을 이용한 애니메이션 효과
1) Before
2) After
코드
//Origin Constraint Layout ConstraintLayout constraintLayout = (ConstraintLayout)_view.findViewById(R.id.const_main); //1. Create ConstraintSet ConstraintSet constraintSet_01 = new ConstraintSet(); ConstraintSet constraintSet_02 = new ConstraintSet(); //2. Clone constraintSet_01.clone(mConstraintLayout); constraintSet_02.clone(getContext(), R.layout.activity_constraint_after); //After ConstraintLayout
//ConstraintSet 2번으로 레이아웃 변경 private void apply() { TransitionManager.beginDelayedTransition(mConstraintLayout); constraintSet_02.applyTo(mConstraintLayout); } //ConstraintSet 1번으로 레이아웃 변경 (원래 레이아웃) private void reset() { TransitionManager.beginDelayedTransition(mConstraintLayout); constraintSet_01.applyTo(mConstraintLayout); }
'안드로이드 > Component' 카테고리의 다른 글
ConstraintLayout -5 ConstraintSet Animation (0) | 2017.06.21 |
---|---|
ConstraintLayout -4 GuideLine (0) | 2017.06.21 |
ConstraintLayout -3 체인속성 (0) | 2017.06.20 |
ConstraintLayout -2 체인 (0) | 2017.06.20 |
Constraint Layout -1 (0) | 2017.06.19 |