MotionLayout: OnSwipe and OnClick on same view
Asked Answered
P

0

11

I am using MotionLayout for my page. I have two states which is toggled with OnSwipe of a view:

<Transition
    motion:constraintSetStart="@+id/start"
    motion:constraintSetEnd="@+id/end"
    motion:duration="700"
    motion:motionInterpolator="easeIn">
    <OnSwipe
        motion:dragDirection="dragUp"
        motion:touchAnchorId="@+id/view"
        motion:touchAnchorSide="bottom"
        motion:touchRegionId="@+id/view" />
</Transition>

I also want to add OnClickListener to this view from code, or add new Transition in scene.xml file, which will do something different then OnSwipe Transition and will be triggered with OnClick of the same view. But both of them blocks OnSwipe. So Is there a way to have OnSwipe and OnClick on the same view?

Thank you

Pincers answered 22/11, 2019 at 14:49 Comment(1)
you can create custom click listener in motion editor and make separate motion scene for that actionRecognition

© 2022 - 2024 — McMap. All rights reserved.