I'm not sure if this helps, but... if I read the above correctly it sounds like you are talking about the panel for the TabHost, when the scrollview has a panel of its own doesn't it? And you want to put the buttons on the scroll view not the TabHost?
I had a look at your example, and added a single line of code above one of your lines (shown below), to set the panel width. It now appears to work as I would expect it to. Have a look.
You may need to adjust the source of the width to something else, but I'll leave that to you.
This hasn't fixed the issue for me - I've tried it on an emulator running Android 2.2 with a resolution of 320x480 and a Samsung phone running Android 2.2.1 at a resolution of 240x320.
As you can see from the picture the button on the right is clipped slightly. (I've set MyTabHost.Color to red and MyScrollView.Panel.Color to transparent to illustrate it better).
It's as if I need to set the MyScrollView.Panel.Width to MyTabHost.Width minus whatever the padding is around each tab.
Activity.Initialize("")
MyTabHost.Initialize("")
Activity.AddView(MyTabHost, 0, 0, Activity.Width, Activity.Height)
MyTabHost.AddTab("Tab 1", "1") 'this is the layout file with the scroll view.
MyScrollView.Panel.LoadLayout("buttons")
I have a further issue with TabHost panels. Please see the attached example.
When the on-screen keyboard is visible the TabHost looks like it is being resized correctly. However the ScrollView.Panel.Height no longer appears to be large enough to allow all of the buttons and fields to be seen.
What should the ScrollView.Panel.Height be set to when the TabHost is resized? Or is there a better way of reacting to the appearance of the keyboard?
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
Dim w = MyScrollView.Width, h = MyScrollView.Height + NewHeight - OldHeight As Int
MyTabHost.Height = NewHeight
Activity.RerunDesignerScript("1", w, h)
End Sub
However, when the keyboard appears the ScrollView is 50dip too short.
I modified the IME_HeightChanged sub as shown below:
B4X:
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
Dim w = MyScrollView.Width, h = MyScrollView.Height + NewHeight - OldHeight As Int
If NewHeight = Activity.Height Then
MyTabHost.Height = NewHeight-50dip
Else
MyTabHost.Height = NewHeight
End If
Activity.RerunDesignerScript("1", w, h)
End Sub
I realise I'm probably missing something obvious but please point it out!
I don't need to leave a 50dip gap between the keypad and MyTabHost when the keypad is visible. I'm just struggling to make the whole layout work when the keypad appears and is subsequently dismissed.