0

I am playing with Transitions on Android. I believe I am setting my layout wrong.

First, when you arrive I have this kind of layout:

Menu

Everything is extended from View class.
For now I don't put the code, it is 300 lines.

Then, when you click on a circle, the given elements (the orange one for example) goes to the top of the screen, using animations:

enter image description here

Every other shape goes off the screen, and the circle goes to the left.

<transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:transitionOrdering="together">


<slide android:duration="2000" android:slideEdge="start">
    <targets>
        <target android:targetId="@id/relativeFragmentBLUE" />
    </targets>
</slide>

<slide android:duration="2000" android:slideEdge="end">
    <targets>
        <target android:targetId="@id/relativeFragmentGREEN" />
        <target android:targetId="@id/relativeFragmentRED" />
    </targets>
</slide>

<changeBounds android:duration="2000">
    <targets>
        <target android:targetId="@id/relativeFragmentORANGE" />
        <target android:targetId="@id/circleORANGE" />
    </targets>
</changeBounds>

</transitionSet>

The result scene is here:

enter image description here

But Animations are not really working.

When I go back from any scene to the Menu, it work perfectly!

1) To get Transition working nicely, the "orange scene layout" has all the other shapes defined, set to invisible. Is it what I'm supposed to do?

2) There are many layouts inside layouts inside layouts (like 8 times). I believe stacking many layouts are breaking the Transitions?

3) To make this work, I had to set empty blocks, and stack 2 layouts. This is where I fail. How can u make a layout like that? (I'm using weight and alignParent, it works but maybe not done well.)

enter image description here

4) I made an animation on the circles before starting the Transition, but it doesn't execute. I believe you can't stack an Animation and a Transition? (even with startDelay)

I repeat, the Transitions are perfect from any scene to the Menu. So the problems comes from my scenes layouts.

Community
  • 1
  • 1
MeGoodGuy
  • 395
  • 2
  • 10

1 Answers1

0

Problem solved.

First i made a different layout file for each colors, to make it clear.

Then i had to set clipChildren to false. (allows children layouts to go outside their parents bounds)

i used an empty RootScene.To finish, i made two different TransitionSet for each colors (in & out)

Its works fine now, but I would like to create 10 layouts and 8 Transitions for one activity.

Vinoth Krishnan
  • 2,925
  • 6
  • 29
  • 34
MeGoodGuy
  • 395
  • 2
  • 10