How do I add a view to a layout?

noist

Member
Hi,

I want to add a view to a layout by code, how do I do that?

Activity.AddView(view, 0, 0, 100%x, 100%y)
just adds it to whatever there is on the screen, but I want to add it to a layout (which is then opened in a Tab of a TabHost).

Thx!
 

klaus

Expert
Licensed User
Longtime User
For each Tab layout, defined in the Designer, you should first add a panel and then add all the views onto thie panels.
Then you load the layouts onto the Tabs.
You can then add views by code to these panels with:
Panel1.AddView(view, x, y, w, h)

Best regards.
 
Upvote 0
Top