У меня есть ConstraintLayout внутри ScrollView.
Я пытаюсь использовать анимацию ConstraintLayout. Он отлично работает вне ScrollView, но когда я хочу использовать его внутри ScrollView, AndroidStudio говорит:
android.support.v4.widget.NestedScrollView cannot be cast to android.support.constraint.ConstraintLayout
Я знаю, потому что мой корневой макет - ScrollView, но я не знаю, как это исправить.
Я пытался добавить еще один ConstraintLayout до ScrollView, на этот раз приложение работало без сбоев, но когда я нажимаю кнопку, ничего не происходит.
<android.support.v4.widget.NestedScrollView
android:id="@+id/scrollView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout
android:id="@+id/const1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light"
tools:context=".MainActivity">
Это то, что я сделал в MainActivity
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(this, R.layout.activity_main_animation);
ChangeBounds transition = new ChangeBounds();
transition.setInterpolator(new AnticipateInterpolator(1.0f));
transition.setDuration(1200);
TransitionManager.beginDelayedTransition(cc1, transition);
constraintSet.applyTo(cc1);