MotionLayout visual glitch on first touch












2














I'm working with a new MotionLayout from the com.android.support.constraint:constraint-layout:2.0.0-alpha2 package.



But I'm witnessing a visual glitch which happens the first time I'm touching the screen. I've got OnSwipe implemented for dragDirection="dragDown"but if I do a drag up before any other action it will show me the end state of animation.
Unforunately, I can't upload a GIF that would show it as it's too big. So I'm attaching all the code:



EDIT
Attaching a video - https://youtu.be/CYZy_Kt_LH0



scene_03.xml



<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">

<Transition
motion:constraintSetStart="@+id/start"
motion:constraintSetEnd="@+id/end"
motion:duration="10000">

<OnSwipe
motion:touchAnchorId="@+id/hpImage"
motion:touchAnchorSide="bottom"
motion:dragDirection="dragDown" />
</Transition>

<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
/>

<Constraint
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginBottom="12dp"
android:textSize="24sp"
android:scaleX="1"
android:scaleY="1"
android:text="Harry Potter"
android:textColor="#fff"
motion:layout_constraintStart_toStartOf="@+id/hpImage"
motion:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>

</ConstraintSet>

<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:visibility = "invisible"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
>
</Constraint>

<Constraint
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginBottom="0dp"
android:scaleX="0.7"
android:scaleY="0.7"
android:gravity="center"
android:text="Harry Potter"
android:textColor="#fff"
motion:layout_constraintStart_toStartOf="@+id/hpImage"
motion:layout_constraintTop_toTopOf="@+id/hpImage"
motion:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>
</ConstraintSet>

</MotionScene>


activity_test.xml



<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.motion.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/motionLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/scene_03"
android:background="@color/whiteSecondary"
tools:showPaths="true">

<View
android:id="@+id/colorBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="@+id/hpImage"
app:layout_constraintEnd_toEndOf="@+id/hpImage"
app:layout_constraintTop_toTopOf="@+id/hpImage"
app:layout_constraintBottom_toBottomOf="@+id/hpImage"
android:background="@color/colorPrimary"
/>

<ImageView
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/hp"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>

<TextView
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginBottom="12dp"
android:textSize="24sp"
android:maxLines="1"
android:text="Harry Potter"
android:textColor="#fff"
app:layout_constraintStart_toStartOf="@+id/hpImage"
app:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>

</android.support.constraint.motion.MotionLayout>









share|improve this question
























  • Did you find any solution about this ? I find something there but not working -> github.com/mtcn/MotionLayoutExamples/blob/master/app/src/main/…
    – lopez.mikhael
    Nov 26 '18 at 10:59
















2














I'm working with a new MotionLayout from the com.android.support.constraint:constraint-layout:2.0.0-alpha2 package.



But I'm witnessing a visual glitch which happens the first time I'm touching the screen. I've got OnSwipe implemented for dragDirection="dragDown"but if I do a drag up before any other action it will show me the end state of animation.
Unforunately, I can't upload a GIF that would show it as it's too big. So I'm attaching all the code:



EDIT
Attaching a video - https://youtu.be/CYZy_Kt_LH0



scene_03.xml



<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">

<Transition
motion:constraintSetStart="@+id/start"
motion:constraintSetEnd="@+id/end"
motion:duration="10000">

<OnSwipe
motion:touchAnchorId="@+id/hpImage"
motion:touchAnchorSide="bottom"
motion:dragDirection="dragDown" />
</Transition>

<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
/>

<Constraint
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginBottom="12dp"
android:textSize="24sp"
android:scaleX="1"
android:scaleY="1"
android:text="Harry Potter"
android:textColor="#fff"
motion:layout_constraintStart_toStartOf="@+id/hpImage"
motion:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>

</ConstraintSet>

<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:visibility = "invisible"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
>
</Constraint>

<Constraint
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginBottom="0dp"
android:scaleX="0.7"
android:scaleY="0.7"
android:gravity="center"
android:text="Harry Potter"
android:textColor="#fff"
motion:layout_constraintStart_toStartOf="@+id/hpImage"
motion:layout_constraintTop_toTopOf="@+id/hpImage"
motion:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>
</ConstraintSet>

</MotionScene>


activity_test.xml



<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.motion.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/motionLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/scene_03"
android:background="@color/whiteSecondary"
tools:showPaths="true">

<View
android:id="@+id/colorBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="@+id/hpImage"
app:layout_constraintEnd_toEndOf="@+id/hpImage"
app:layout_constraintTop_toTopOf="@+id/hpImage"
app:layout_constraintBottom_toBottomOf="@+id/hpImage"
android:background="@color/colorPrimary"
/>

<ImageView
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/hp"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>

<TextView
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginBottom="12dp"
android:textSize="24sp"
android:maxLines="1"
android:text="Harry Potter"
android:textColor="#fff"
app:layout_constraintStart_toStartOf="@+id/hpImage"
app:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>

</android.support.constraint.motion.MotionLayout>









share|improve this question
























  • Did you find any solution about this ? I find something there but not working -> github.com/mtcn/MotionLayoutExamples/blob/master/app/src/main/…
    – lopez.mikhael
    Nov 26 '18 at 10:59














2












2








2







I'm working with a new MotionLayout from the com.android.support.constraint:constraint-layout:2.0.0-alpha2 package.



But I'm witnessing a visual glitch which happens the first time I'm touching the screen. I've got OnSwipe implemented for dragDirection="dragDown"but if I do a drag up before any other action it will show me the end state of animation.
Unforunately, I can't upload a GIF that would show it as it's too big. So I'm attaching all the code:



EDIT
Attaching a video - https://youtu.be/CYZy_Kt_LH0



scene_03.xml



<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">

<Transition
motion:constraintSetStart="@+id/start"
motion:constraintSetEnd="@+id/end"
motion:duration="10000">

<OnSwipe
motion:touchAnchorId="@+id/hpImage"
motion:touchAnchorSide="bottom"
motion:dragDirection="dragDown" />
</Transition>

<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
/>

<Constraint
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginBottom="12dp"
android:textSize="24sp"
android:scaleX="1"
android:scaleY="1"
android:text="Harry Potter"
android:textColor="#fff"
motion:layout_constraintStart_toStartOf="@+id/hpImage"
motion:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>

</ConstraintSet>

<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:visibility = "invisible"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
>
</Constraint>

<Constraint
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginBottom="0dp"
android:scaleX="0.7"
android:scaleY="0.7"
android:gravity="center"
android:text="Harry Potter"
android:textColor="#fff"
motion:layout_constraintStart_toStartOf="@+id/hpImage"
motion:layout_constraintTop_toTopOf="@+id/hpImage"
motion:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>
</ConstraintSet>

</MotionScene>


activity_test.xml



<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.motion.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/motionLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/scene_03"
android:background="@color/whiteSecondary"
tools:showPaths="true">

<View
android:id="@+id/colorBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="@+id/hpImage"
app:layout_constraintEnd_toEndOf="@+id/hpImage"
app:layout_constraintTop_toTopOf="@+id/hpImage"
app:layout_constraintBottom_toBottomOf="@+id/hpImage"
android:background="@color/colorPrimary"
/>

<ImageView
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/hp"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>

<TextView
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginBottom="12dp"
android:textSize="24sp"
android:maxLines="1"
android:text="Harry Potter"
android:textColor="#fff"
app:layout_constraintStart_toStartOf="@+id/hpImage"
app:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>

</android.support.constraint.motion.MotionLayout>









share|improve this question















I'm working with a new MotionLayout from the com.android.support.constraint:constraint-layout:2.0.0-alpha2 package.



But I'm witnessing a visual glitch which happens the first time I'm touching the screen. I've got OnSwipe implemented for dragDirection="dragDown"but if I do a drag up before any other action it will show me the end state of animation.
Unforunately, I can't upload a GIF that would show it as it's too big. So I'm attaching all the code:



EDIT
Attaching a video - https://youtu.be/CYZy_Kt_LH0



scene_03.xml



<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">

<Transition
motion:constraintSetStart="@+id/start"
motion:constraintSetEnd="@+id/end"
motion:duration="10000">

<OnSwipe
motion:touchAnchorId="@+id/hpImage"
motion:touchAnchorSide="bottom"
motion:dragDirection="dragDown" />
</Transition>

<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
/>

<Constraint
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginBottom="12dp"
android:textSize="24sp"
android:scaleX="1"
android:scaleY="1"
android:text="Harry Potter"
android:textColor="#fff"
motion:layout_constraintStart_toStartOf="@+id/hpImage"
motion:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>

</ConstraintSet>

<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:visibility = "invisible"
motion:layout_constraintStart_toStartOf="parent"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintTop_toTopOf="parent"
>
</Constraint>

<Constraint
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginBottom="0dp"
android:scaleX="0.7"
android:scaleY="0.7"
android:gravity="center"
android:text="Harry Potter"
android:textColor="#fff"
motion:layout_constraintStart_toStartOf="@+id/hpImage"
motion:layout_constraintTop_toTopOf="@+id/hpImage"
motion:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>
</ConstraintSet>

</MotionScene>


activity_test.xml



<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.motion.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/motionLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/scene_03"
android:background="@color/whiteSecondary"
tools:showPaths="true">

<View
android:id="@+id/colorBackground"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintStart_toStartOf="@+id/hpImage"
app:layout_constraintEnd_toEndOf="@+id/hpImage"
app:layout_constraintTop_toTopOf="@+id/hpImage"
app:layout_constraintBottom_toBottomOf="@+id/hpImage"
android:background="@color/colorPrimary"
/>

<ImageView
android:id="@+id/hpImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/hp"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>

<TextView
android:id="@+id/tvHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginBottom="12dp"
android:textSize="24sp"
android:maxLines="1"
android:text="Harry Potter"
android:textColor="#fff"
app:layout_constraintStart_toStartOf="@+id/hpImage"
app:layout_constraintBottom_toBottomOf="@+id/hpImage"
/>

</android.support.constraint.motion.MotionLayout>






android android-animation android-motionlayout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 1:29

























asked Nov 23 '18 at 1:21









Vendetta8247

3171323




3171323












  • Did you find any solution about this ? I find something there but not working -> github.com/mtcn/MotionLayoutExamples/blob/master/app/src/main/…
    – lopez.mikhael
    Nov 26 '18 at 10:59


















  • Did you find any solution about this ? I find something there but not working -> github.com/mtcn/MotionLayoutExamples/blob/master/app/src/main/…
    – lopez.mikhael
    Nov 26 '18 at 10:59
















Did you find any solution about this ? I find something there but not working -> github.com/mtcn/MotionLayoutExamples/blob/master/app/src/main/…
– lopez.mikhael
Nov 26 '18 at 10:59




Did you find any solution about this ? I find something there but not working -> github.com/mtcn/MotionLayoutExamples/blob/master/app/src/main/…
– lopez.mikhael
Nov 26 '18 at 10:59












1 Answer
1






active

oldest

votes


















0














possible fix in alpha 3 version of constraintlayout https://androidstudio.googleblog.com/2018/12/constraintlayout-200-alpha-3.html






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439646%2fmotionlayout-visual-glitch-on-first-touch%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    possible fix in alpha 3 version of constraintlayout https://androidstudio.googleblog.com/2018/12/constraintlayout-200-alpha-3.html






    share|improve this answer


























      0














      possible fix in alpha 3 version of constraintlayout https://androidstudio.googleblog.com/2018/12/constraintlayout-200-alpha-3.html






      share|improve this answer
























        0












        0








        0






        possible fix in alpha 3 version of constraintlayout https://androidstudio.googleblog.com/2018/12/constraintlayout-200-alpha-3.html






        share|improve this answer












        possible fix in alpha 3 version of constraintlayout https://androidstudio.googleblog.com/2018/12/constraintlayout-200-alpha-3.html







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 22 '18 at 23:26









        palatin

        112




        112






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53439646%2fmotionlayout-visual-glitch-on-first-touch%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Berounka

            Sphinx de Gizeh

            Different font size/position of beamer's navigation symbols template's content depending on regular/plain...