5

I have this transition in my MotionLayout.

<Transition
    android:id="@+id/transition_validate"
    motion:constraintSetEnd="@id/endRight"
    motion:constraintSetStart="@id/start"
    motion:duration="400"
    motion:motionInterpolator="easeOut">
  <OnClick
      motion:clickAction="transitionToEnd"
      motion:targetId="@id/trueButton" />
  <OnSwipe
      motion:dragDirection="dragRight"
      motion:touchAnchorId="@id/card"
      motion:touchRegionId="@id/card"
      motion:touchAnchorSide="right" />

the rectangle in the middle is the cardView with card as id. the buttons left and right of the screen are trueButton/falseButton

My problem is that after I added motion:touchRegionId="@id/card" to onSwipe, I can't no longer clic on 1, ie the part of trueButton that is above card to launch the animation (it's actually on false instead of true on the screen attached but you get the idea), I have to clic on 3 ie, the part of trueButton that is not above the card.

enter image description here

Have you ever seen something like that ? Do you know how can I restrain onSwipe to card touches but have clicks on the buttons launch the animations ?

Thanks

Renaud Favier
  • 1,645
  • 1
  • 17
  • 33

0 Answers0