Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – Motion layout start animation at start

Posted on November 11, 2022 By

Solution 1 :

You could use methods transitionToStart / transitionToEnd on MotionLayout to perform animations from code. And therefore you can call this methods in onStart/onResume Fragment or Activity methods for example.
https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout#transitionToEnd()

Example:

class MyFragment: Fragment() {

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        // Start animation programmatically after all views created
        motion_layout.transitionToEnd()
    }
}

Problem :

I’ve been watching motion animation layout videos and I’ve seen that the animation gets activated after a click or a swipe, how can I make the animation start when all the views have been created, like for example in a Hero Animation?

Comments

Comment posted by AgentP

I have’t tried it personally if it’s working after a click how about calling performClick() on a view after allviews created?

Comment posted by Andrey Solera

can you please add code examples on how to use the code please?

READ  [FIXED] android - How to save data passed from another activity in Kotlin?
Powered by Inline Related Posts
Android Tags:android, animation, layout, motion

Post navigation

Previous Post: [FIXED] java – android studio 4.0 cannot load jdk class
Next Post: [FIXED] java – How can ViewParent be cast into View?

Related Posts

[FIXED] android – Change TimePickerDialog to show time of specific country Android
[FIXED] android – Notifying Activity From ViewModel Android
[FIXED] Can I upload lint-result.xml to SonarQube in Android Gradle project? Android
[FIXED] Connection between IP camera and Android Studio Android
[FIXED] java – How to pick an image from gallery and store into SqLite database Android
[FIXED] android – How to join multiple observables in rxjava Android

Archives

  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can Vicks humidifier be used without filter?
  • What color is Spanish green?
  • How old is Jamie in The War That Saved My Life?
  • When should I use scalp massager for hair growth?
  • Can I put polyurethane over liming wax?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme