Closed ahmed3elshaer closed 7 years ago
Unfortunately CoordinatorLayout is not a usual layout. It is too smart and don't care about the way how transitions works. Every ordinal layout are changing positions of children only on layout stage. And after that they are just drawing. So ChangeBound is moving views inside a parent without layout calls. But CoordinatorLayout is trying to calculate positions and fix wrong offsets before every draw. That's it. Transitions from framework will also not work in that case, not only my backport. By the way, you are not using any scroll behaviours, as I can see. why do you need CoordinatorLayout at all? Why not to replace with RelativeLayout(or maybe even ConstraintLayout)?
Thanks alot for your answer it is really helpful, im using coordination layout to use anchor _gravity to help me put the FAB in its position in the screenshot and to move it to the place that i want i will try to use another layout
i have a CoordinationLayout having FramLayout(Constains a Fab and other view) inside of it with anchor_gravity="top|right|end" and i want to apply ArchMotion on it that changes it's anchor gravity to center and i did like the PathMotion sample exactly here is a screenshot of the layout:-
and here is the layout code:
` <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
</android.support.design.widget.CoordinatorLayout> `
I want to animate the framlayout with id flAnimation and the view it contains (FloatingActionButton and LottieAnimationView)
i attach click listener to FAB and LottieAnimationView and here is the code inside
TransitionManager.beginDelayedTransition(coordinatorLayout, new ChangeBounds().setPathMotion(new ArcMotion()).setDuration(1000)); CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) flAnimation.getLayoutParams(); lp.anchorGravity = Gravity.CENTER; flAnimation.setLayoutParams(lp);
what happened is that the FramLayout(llDetails) and it's view moving to the center without any animation happens