I have set up a transition between constraints_start and constraints_end, which is triggered by a swipe gesture on the header or NestedScrollView. The XML for this transition is as follows:

<Transition
    motion:constraintSetEnd="@id/constraints_end"
    motion:constraintSetStart="@id/constraints_start"
    motion:duration="300"
    motion:motionInterpolator="linear"
    motion:layoutDuringTransition="honorRequest">
    <OnSwipe
        motion:dragDirection="dragUp"
        motion:onTouchUp="decelerate"
        motion:touchAnchorId="@id/nsv_gf_list"
        motion:touchAnchorSide="top" />
</Transition>

The issue I'm facing is that when I programmatically set the transition state using setTransition or transitionToState, the NestedScrollView seems to scroll on its own, and the MotionLayout transition doesn't trigger immediately. However, it works as intended if I manually scroll on the header after setting the transition programmatically.

Steps to Reproduce:

Programmatically set the transition state using setTransition or transitionToState. Observe that the NestedScrollView starts scrolling on its own. Manually scroll on the header After the manual scroll, the MotionLayout transition triggers as expected.

The MotionLayout transition should be triggered programmatically without the need for a manual scroll on the header or NestedScrollView.

0

There are 0 best solutions below