How to set textview size in android MotionLayout when animation executing?

88 views Asked by At

I'm using an Android motion layout. Animation is implemented through scale change, but the size of the internal text view is reduced together, making it strange to see. Is there a way to fix or increase the size of the internal textview?

Here I attach my symptoms and some codes.

this is motionscene xml

  <Transition
        app:constraintSetEnd="@+id/b"
        app:constraintSetStart="@+id/a"
        app:duration="300"
        app:motionInterpolator="linear"
        app:autoTransition="none">
        <KeyFrameSet>
            <KeyAttribute
                app:motionTarget="@+id/main_fragment_CalendarLayout"
                app:framePosition="0"
                android:scaleX="1.0" />
            <KeyAttribute
                app:motionTarget="@+id/main_fragment_CalendarLayout"
                app:framePosition="0"
                android:scaleY="1.0" />

            <KeyAttribute
                app:motionTarget="@+id/main_fragment_CalendarLayout"
                app:framePosition="100"
                android:scaleX="0.5" />
            <KeyAttribute
                app:motionTarget="@+id/main_fragment_CalendarLayout"
                app:framePosition="100"
                android:scaleY="0.25"
                />
        </KeyFrameSet>
    </Transition>
</MotionScene>

code is just control transition to start or end.

        var test = true
        binding.topBarLayoutChangeBtn.setOnClickListener {

            if(test)
                binding.mainFragmentRoot.transitionToEnd()
            else
                binding.mainFragmentRoot.transitionToStart()
            test = !test

enter image description here

Thank you.

0

There are 0 answers