I may have overlooked something obvious, but I've run into a problem with using a TabHost.
I want to add a canvas to each panel that is linked to the TabHost, but when I initialise the canvas naming one of the linked panels I get a Java exception at runtime.
I tried to create a new panel that would sit over the top of the same area as the linked panels, but couldn't work out how to provide the AddView with the correct coordinates and width/height. I get a run time error if I try and use a linked panel's top/left/width/height properties.
I have done it successfully using the TabHost properties, but of course this includes the tab area of the view, that I don't want to have the canvas write over.
So, how can I either use one of the existing linked panels (the preferred option), or determine the "working" area of the TabHost (without the tab area) so I can use another panel the correct size?
And even if I used the designer like you suggest, I don't understand how I could use a canvas method like DrawLine on the panel without having already done something like:
B4X:
cvsDraw.Initialize (drawingpanel1)
If I do that canvas initialize then I get a runtime Java error.
You will need to use AddTabWithIcon and load the layout file. 100%x / 100%y in the designer script are related to the parent which is the TabHost in this case.
My only surprise is that I have to use the Designer for this, and that I can't achieve the same result using only code. I would have thought that since the TabHost must "know" what position/size its panels are, to use them, that this would would be available to the rest of the environment.
E.g. in my example code above I would have thought that I would be able to use drawingpanel1.height without getting a runtime error.