Android Question How can i clone a panel with contents programatically

Erel

B4X founder
Staff member
Licensed User
Longtime User
Create a layout file with the panel contents:
B4X:
Sub CreateNewPanel (Width As Int, Height As Int) As Panel
 Dim p As Panel
 p.Initialize
 p.SetLayout(0, 0, Width, Height)
 p.LoadLayout(...)
 Return p
End Sub
Add the returned panel to your layout.

A more robust approach is to create a class for this panel. This will make it easier to handle the events of the controls inside the panel.
 
Upvote 0

FrostCodes

Active Member
Licensed User
Create a layout file with the panel contents:
B4X:
Sub CreateNewPanel (Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize
p.SetLayout(0, 0, Width, Height)
p.LoadLayout(...)
Return p
End Sub
Add the returned panel to your layout.

A more robust approach is to create a class for this panel. This will make it easier to handle the events of the controls inside the panel.



li really appreciate... please how do i create this class.. i tried using custom view but it has no gui support and i already have this panel designed really nice now using code is kind of difficult for me
 
Upvote 0
Top