How do I progmatically add views to a tab(host)

barx

Well-Known Member
Licensed User
Longtime User
Hi everyone, I'm brand new to B4A and I'm very excited about getting to grips with it creating my first app. Anyways, I'm trying to build an app that has a Tabhost (3 tabs) on the main activity. Got this done ok. Next I would like to progmatically add listviews to 2 of the the tabs. How do you specify which tab your adding to. The reason I want to do it in code is you seem to have more control over the views' properties this way. i.e. height and width can be %, etc. Designer only seems to allow 'real numbers'.

Thanks for the help.
 

barx

Well-Known Member
Licensed User
Longtime User
Just downloaded and looked at the 'helper'. Looked up tabhost and noticed it has a second variation that allows you to use panels instead of layouts. Think I will have a play with that method. Thanks for your suggestion.

I take it, if I add it with the designer, I can still re-size? The only saving with this method then I take it would be I wouldn't have to initialise the view?
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
What would be the correct way to get a panel to fill the tab space.

PanelTab1.Width = 100%
PanelTab1.Height = 100%

or

PanelTab1.Width = TabHostMain.Width
PanelTab1.Width = TabHostMain.Height

or

something else.

Don't want to sound thick. Once I get my feet wet I'll soon pick it up.

Thanks again
 
Upvote 0
Top