Android Question adding label dynamically on B4xPages

giada

Member
i need to add by code a label on a B4XPAges...
i found this code
B4X:
Dim ButtonX As Button
ButtonX.Initialize("Button")
ButtonX.Tag = PosX
Activity.AddView(ButtonX,x*33%x,y*20%y,33%x,20%y)
What is the correspong code of Activity.AddView(... for B4XPAges?
thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Root.AddView.

While you can use percentage, it is less recommended as it is not cross platform. You can use 0.33 * Root.Width instead.

Tips:
- Do whatever you can with the designer. It will make things simpler, especially with cross platform projects.
- If you want to create a label, you can use XUIViewsUtils.CreateLabel from XUI Views library.
 
Upvote 0
Top