Android Question Help with animation

apty

Active Member
Licensed User
i am trying to animate panels added to a scrollview in B4A. I want to achieve animation like in the video attached. Please help.


 

LucaMs

Expert
Licensed User
I tried a quick test, without thinking a lot.

The idea is to create a class for each panel-row to animate.

In the example, the Main is passed to the class but you can pass the panel that will contain the various panels-rows.

The problem is that when you resize the width you will have to add also the animation of the internal views (in the tick event of the timer).
 

Attachments

apty

Active Member
Licensed User
Thanks a lot for the help. In my case, i load the panels as in the code below
B4X:
For i=0 To 9
        Dim Panel1 As Panel
        Dim pnlAllTrips As Panel
        Dim lblMonth As Label
        Dim lblYear As Label
        Dim lblReturn As Label
        Dim lblAmnt As Label
        Panel1.Initialize("")
        Panel1.LoadLayout("alltrips")
        Panel1.Color = Colors.Transparent
    ScrollView1.Panel.AddView(Panel1,10dip,px,100%x-20dip,60dip)
       If i=0 Then
            Panel1.Width=90%x 
        Else If i=1 Then
....
Using your approach i have been unable to get the panel width so that i can modify it accordingly. How can i add the width property?
 

LucaMs

Expert
Licensed User
Using your approach i have been unable to get the panel width so that i can modify it accordingly. How can i add the width property?
Mine was just an example, to say that you can create a class in which you can handle the animation, with SetLayoutAnimated, timers and events like those I wrote in the example.

You could pass the item panel you created by code (Panel1 in your code above) to the Inititialize routine of the class (without the need to create a panel inside the class, then).
 

LucaMs

Expert
Licensed User
Mine was just an example, to say that you can create a class in which you can handle the animation, with SetLayoutAnimated, timers and events like those I wrote in the example.

You could pass the item panel you created by code (Panel1 in your code above) to the Inititialize routine of the class (without the need to create a panel inside the class, then).
Something like this one:
 

Attachments

LucaMs

Expert
Licensed User
You could (should) also use xCustomListView, create a class for the animation and pass the xCustomListView items (panels) to your class.
You can also use a single class instance instead of one for each item.
 
Top