Android Question [B4X] Cross Platform UI development


Active Member
Licensed User
Longtime User
Hi all,

I've been reading and watching videos about B4X approach to multi platform development and I've realized that we can develop code that tries to be multi platform (XUI) but if we use the internal designer to create layouts, we need to create the layouts in each platform we want to use (Erel shows this in his video "XUI Cross Platform Example").

To avoid having to create layouts in each platform, I'm thinking in creating the controls on the code or have some kind of layout generator.

My question is, after having that, what's the correct way to add the controls in a multi platform way?

It's something like:

Dim myBtn As B4XView

#If B4A
Activity.AddView(myBtn, 100dip, 100dip, 100dip, 100dip)
#Else If B4j
#End If

This would be the correct way to approach such a scenario?



Licensed User
Longtime User
Yes, you will need to initialize and place the views according to the targeted platform.
Upvote 0