Wish [B4X] [XUI] B4XPages: animations between two pages

wimpie3

Well-Known Member
Licensed User
Longtime User
I was looking into B4XPages and I saw that when you show a page, the previous page is *immediately* removed from the screen.

This poses a problem when it comes to animations. You can let the new page slide in, but you can't let the old one slide out since it doesn't exist anymore at that time.

So if you want to slide in and out pages - which is something pretty basic in Android - that is impossible to do with B4XPages.

I don't know how B4Xpages is made, but would this be something that can be added? It would certainly make some apps look more professional (at least my apps, I won't speak for others)
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
I was looking into B4XPages and I saw that when you show a page, the previous page is *immediately* removed from the screen.

This poses a problem when it comes to animations. You can let the new page slide in, but you can't let the old one slide out since it doesn't exist anymore at that time.

So if you want to slide in and out pages - which is something pretty basic in Android - that is impossible to do with B4XPages.

I don't know how B4Xpages is made, but would this be something that can be added? It would certainly make some apps look more professional (at least my apps, I won't speak for others)
You (we) could try using a trick.

Take the image of the page to be removed (Root.Snapshot), "import" it into the "incoming" page, using a B4XImageView on top of the Root of the new page and moving it appropriately off the screen, and then remove it (although once off the screen it does not it would be necessary).

Haven't tried, this is just half an idea that came to my mind while reading your post.


P.S. https://www.b4x.com/android/forum/threads/custom-transitions-between-b4xpages.119447/post-747087
I also found a working test project of mine.
 

Attachments

  • TransitionTest.zip
    63.5 KB · Views: 160
Last edited:

wimpie3

Well-Known Member
Licensed User
Longtime User
That's a good idea. I didn't think of that. It's a bit of a hack though... But it might work!
 

wimpie3

Well-Known Member
Licensed User
Longtime User
The solution proposed by Erel works well; I applied it in the test project attached to the previous post.
The solution proposed by Erel does exactly what I said in my first post: it removes the previous page before animating the next one. That's not what I'm looking for. I really want to keep the previous page visible as long as the animation is running.
 

LucaMs

Expert
Licensed User
Longtime User
The solution proposed by Erel does exactly what I said in my first post: it removes the previous page before animating the next one. That's not what I'm looking for. I really want to keep the previous page visible as long as the animation is running.
Well, try this one:
Take the image of the page to be removed (Root.Snapshot), "import" it into the "incoming" page, using a B4XImageView on top of the Root of the new page and moving it appropriately off the screen, and then remove it (although once off the screen it does not it would be necessary).
 
Top