Whoops! Spoke too soon...
Well, I separated each panel into its own BAL file, and loaded them with AddTabWithIcon. It generates a tabhost, but the results are the same - the screen sizes change when switching from one tab to another.
In each Designer, I selected the panel and made Left=0, Top=0, Width=320 and Height=480.
used anchors for Top (BOTH) and bottom (BOTH).
I added code to the designer script:
pnl_panelname.setleftandright(0,100%x)
pnl_panelname.settopandbottom(0,100%y)
The results in Tabhost are a missing section on the left of most of the screens, when selected.
I had some code to change the background gradients on-the-fly,
For Each v As View In Activity.GetAllViewsRecursive
Log(v)
Next
and saw the following:
PackageAdded: package:b4a.example
** Activity (main) Create, isFirst = true **
** Activity (main) Create, isFirst = true **
Installing file.
PackageAdded: package:b4a.example
** Activity (main) Create, isFirst = true **
** Activity (main) Create, isFirst = true **
(TabHost): Left=0, Top=0, Width=720, Height=1180
(LinearLayout): Layout not available
(TabHost): Left=0, Top=0, Width=720, Height=1180
(TabWidget): Layout not available
(RelativeLayout): Layout not available
(LinearLayout): Layout not available
(TabWidget): Layout not available
(RelativeLayout): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(RelativeLayout): Layout not available
(RelativeLayout): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(RelativeLayout): Layout not available
(RelativeLayout): Layout not available
(ImageView): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(TextView): Layout not available
(RelativeLayout): Layout not available
(RelativeLayout): Layout not available
(ImageView): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(TextView): Layout not available
(FrameLayout): Layout not available
(FrameLayout): Layout not available
(BALayout): Layout not available
(BALayout): Layout not available
(BALayout): Left=0, Top=0, Width=680, Height=1012, Tag=
(BALayout): Left=0, Top=0, Width=680, Height=1012, Tag=
(Button): Enabled=false, Left=64, Top=257, Width=556, Height=128, Tag=
(Button): Enabled=false, Left=64, Top=257, Width=556, Height=128, Tag=
(Button): Enabled=false, Left=64, Top=428, Width=556, Height=128, Tag=
(Button): Left=64, Top=599, Width=556, Height=128, Tag=
(Button): Enabled=false, Left=64, Top=428, Width=556, Height=128, Tag=
(Button): Left=64, Top=599, Width=556, Height=128, Tag=
** Activity (main) Resume **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **
(TabHost): Left=0, Top=0, Width=720, Height=1180
(LinearLayout): Layout not available
(TabWidget): Layout not available
(RelativeLayout): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(RelativeLayout): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(RelativeLayout): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(RelativeLayout): Layout not available
(ImageView): Layout not available
(TextView): Layout not available
(FrameLayout): Layout not available
(BALayout): Layout not available
(BALayout): Left=0, Top=0, Width=680, Height=1012, Tag=
(Button): Enabled=false, Left=64, Top=257, Width=556, Height=128, Tag=
(Button): Enabled=false, Left=64, Top=428, Width=556, Height=128, Tag=
(Button): Left=64, Top=599, Width=556, Height=128, Tag=
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
The relevant code is here:
Dim TH1 as Tabhost
TH1.Initialize("TH1a")
TH1.Background = GD_BG
Activity.AddView(TH1,0,0,100%x,100%y)
AddTab("Start!","main","9_av_play.png")
AddTab("Contacts","contacts","6_social_add_person.png")
AddTab("Destination","destination","7_location_place.png")
AddTab("Alerts","alerts","13_map_ruler.png")
'
'loop through activity views, if panel, change backgrounds
For Each v As View In Activity.GetAllViewsRecursive
Log(v)
If v Is Panel Then
Dim pnl As Panel = v
pnl.Background=GD_BG
End If
Next
'
'build preferences (scrollview in tabhost)
'
scv_Prefs.Initialize(1500)
scv_Prefs.Panel.Initialize("")
' Activity.AddView(scv_Prefs,0,0,100%x,100%y)
Dim panel0 As Panel = scv_Prefs.Panel
Activity.LoadLayout("preferences")
pnl_Prefs.RemoveView
panel0.AddView(pnl_Prefs,0,0,100%x,pnl_Prefs.Height)
Dim bmp1, bmp2 As Bitmap
bmp1=LoadBitmap(File.DirAssets,"2_action_settings.png")
bmp2=bmp1
TH1.AddTabWithIcon2("Prefs",bmp1,bmp2,scv_Prefs)
End Sub
Sub AddTab(tTitle As String, tLayout As String, tBitmap As String)
Dim bmp1, bmp2 As Bitmap
bmp1 = LoadBitmap(File.DirAssets,tBitmap)
bmp2 = bmp1
TH1.AddTabWithIcon(tTitle, bmp1, bmp2, tLayout)
End Sub
I also tried commenting out the scrollview which is added later, and this did not change the behavior.
Android 4.3 on SG3 with the latest & greatest B4A update, if that helps.