Need Help with TabHost + ScrollView

WiLey2000

Member
Licensed User
Longtime User
Hi All,

I'm really new to programming. I created a very simple app about 8 months ago and have not used B4a since then.

I'm tring to create a ScrollView with a panel inside the ScrollView in a TabHost. I have 3 different tabs with 3 different ScrollViews and 3 Different panels created with the designer. When the TabHost loads it loads the first Tab, but when you select a different tab the panels do not change. I think I might need to initialize the scrollview, but not sure how to do that.

When the attached app launches there is a splash screen and then the main menu. From the main menu click the button "Open Selected" in the "Units that need Inspecting area.

Thanks in advance!

John
 

Attachments

You need to change the lines below:
Code: Copy
Sub Activity_Create(FirstTime As Boolean)
    For i = Activity.NumberOfViews - 1 To 0 Step -1
    Activity.RemoveViewAt(i)
    Next
    Activity.LoadLayout("CraneReport")
    scrviewHst_trlly.Panel.LoadLayout("Hst_trlly")
'    tabhCraneReport.AddTab("Hoist & Trolley", "Hst_trlly") 
    tabhCraneReport.AddTab2("Hoist & Trolley", scrviewHst_trlly) 
    scrviewCrane.Panel.LoadLayout("Crane")
'    tabhCraneReport.AddTab("Crane", "Crane")
    tabhCraneReport.AddTab2("Crane", scrviewCrane)
    scrviewMono_Runway.Panel.LoadLayout("Mono_Runway")
'    tabhCraneReport.AddTab("Runways", "Mono_Runway")
    tabhCraneReport.AddTab2("Runways", scrviewMono_Runway)
End Sub
You must add the ScrollViews to the TabHost and not the layout files.

I appreciate that you directly posted the code, so it's 'easy' to help :).

Best regards.
 
Upvote 0
Thanks for the reply klaus

As always, worked like a charm! Read alot of your posts here and
have learned alot from you!

You da man!

John
 
Upvote 0
Back
Top