Android Question Custom transitions between B4XPages


Well-Known Member
Licensed User
I use this code to create an animation transition (left/right or right/left) between activities:
Is possible to make this with B4XPages?
If yes, how?

Thanks in advance for any tip.


Staff member
Licensed User
Activity transitions will not work with B4XPages as all pages are actually in the same activity.

The pages are animated from the top left corner (if TransitionAnimationDuration > 0).

You can create your own animations, though the previous page will immediately be removed.
In page 2:
Public Sub AnimateFromBotton
    #if B4A
    Root.Top = 100%y
    Root.SetLayoutAnimated(300, 0, 0, Root.Width, Root.Height)
    #End If
End Sub
In main page:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    B4XPages.AddPage("Page 2", Page2)
End Sub

Sub Button1_Click
    B4XPages.ShowPage("Page 2")
End Sub
Upvote 0


Licensed User
Before finding this thread I had tried something similar to this (different animation and unique public routine, written in the B4XMainPage, to which pass the Root of the page to open).

Unfortunately, both with my routine placed there and with Erel's routine, inside the page itself, there is a problem: how to run the animation when you come back to the page? The call to the routine should be written in the B4XPage_Appear event but also by setting Root.Visible = False it appears before the animation. Can it be solved?

The page (Root) with the hand still appears, for a moment, before the animation, despite the setting: Root.Visible = False.
Last edited:
Upvote 0