0

OnSwipe animation does't work here:

     <androidx.constraintlayout.motion.widget.MotionLayout
            android:id="@+id/constraintLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layoutDescription="@xml/list_row_xml_constraintlayout_scene"
            >
    <... View
     android:onClick="@{()->listener.onClick(row)}">
    ...
    </androidx.constraintlayout.motion.widget.MotionLayout>

...
<Transition
        motion:constraintSetEnd="@+id/end"
        motion:constraintSetStart="@id/start"
        motion:duration="1000">
       <KeyFrameSet>
       </KeyFrameSet>
        <OnSwipe
            motion:touchAnchorId="@+id/list_card"
            motion:dragDirection="dragLeft"
            />
    </Transition>

It works, if I remove android:onClick="@{()->listener.onClick(row)}"

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 06 '22 at 21:39
  • Where is the view you added the on click on? Are you trying to swipe and click on the same view? Generally if you want a combination of swipe and click on the same surface you will need to manage some aspect of it yourself. Let MotionLayout handle the swipe and you add touchListener to decide when to click. – hoford Aug 08 '22 at 14:07

0 Answers0