MotionLayout: OnSwipe and OnClick on same view

亡梦爱人 提交于 2021-01-21 07:31:28

问题


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

来源:https://stackoverflow.com/questions/58996674/motionlayout-onswipe-and-onclick-on-same-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!