Android Question Add CustomView from Code

Emme Developer

Well-Known Member
Licensed User
Hi!
When create a new custom view, there is this sub
B4X:
Public Sub DesignerCreateView (Base As Panel, Lbl As Label, Props As Map)
    mBase = Base
End Sub

That can be used to adjust size of view. But this subs is called only when view is added using designer. there is a way to call a sub like this when a view is added programmatically?
I want to do something like Pnl.Addview(customview) as happens with all other base android view, without doing a properly method.
Is possible?
I hope i clearly explain. Thanks!
 

Emme Developer

Well-Known Member
Licensed User
Most custom views (at least the ones I wrote) can only be added with the designer. If a developer wants to create the layout programmatically then he can create a layout file with the custom view and load it whenever needed.
I know this, but i ask the question because i want to share a list of custom view. For others developer i think is "busy/difficult" to add all them in a layout and load it when they need
 
Upvote 0
Top