Android Question Best way to arrange views in designer?

Multiverse app

Active Member
Licensed User
Longtime User
For all B4A projects, I add all the views needed for different screens into one layout file and load their dimensions in Activity_Resume:
upload_2018-10-23_22-9-51.png


I know it is a lot messy, but this way, it is easier to manage all the views from one single file.

I wanted to know if this method is ideal? Or should I make different designer files for all the different screens?

What do you guys prefer?
 

DonManfred

Expert
Licensed User
Longtime User
What do you guys prefer?
One layoutfile per Screen resp. per panel. I usually use CLV (one layout) and Panels for the content (one layout for each different layout for the panel used in CLV).

I do not like all on one like in the pic above

But at the end it is up to you and what you are more familar with.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I fully agree with DonManfred!
How do you manage the views in Activity_Resume?
For me, it's not a good solution. You should manage the views in the DesignerScripts.
I suppose you are using only one Activity, even thoug I would use different layout files, one for each 'screen' panel, they are much easier to maintain.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is not a recommended approach.

1. You lose all kinds of features such as anchors, auto scale all (will not work properly) and designer script will be more complicated to manage.
2. Why load all the views when the program starts? Will be faster to load the currently required layout and load more as needed.
3. You can have any number of layout files. I think that it will be easier to manage smaller layouts. It will also be more flexible.
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
its also possible to use loadlayout more than once, so u can combine elements in one activity.
.loadlayout("A")
.loadlayout("B")

@Erel
it woule be nice if the designer using tabs (extra windows) for opened designs.
 
Last edited:
Upvote 0
Top