Android Question ScrollView in TabHost

Sinan Tuzcu

Well-Known Member
Licensed User
Hallo,

i create with the following code a Scrollview with some Buttons and Labels.
I want to add this Scrollview in a Tabhost.

Who knows how this it works?
Who can help me?

Code for create Scrollview:
B4X:
ScrollView1.Initialize(193dip * 10) 'Innere Höhe definieren (nicht sichtbar)
    Activity.AddView(ScrollView1, 2%x, 30%y, 96%x, 65%y) 'Sichtbare Linkaabstand, Obenabstand, Breite, Höhe definieren
    For i = 0 To 31 'Relais Anzahl definieren von 0 bis 31 sind 32 Relais
        Dim p As Panel
        p.Initialize("")
        p.Tag = i
        p.LoadLayout("relais")
        For v = 0 To p.NumberOfViews - 1
            p.GetView(v).Tag = p 'set the panel as the Tag value
        Next
        ScrollView1.Panel.AddView(p, 0, i * 60dip, ScrollView1.Panel.Width, 58dip)
    Next

thanks in advance
Sinan
 

Sinan Tuzcu

Well-Known Member
Licensed User
Solved:

B4X:
Sub Relais_In_ScrollView
    ScrollView1.Initialize(193dip * 10) 'Innere Höhe definieren (nicht sichtbar)
    Activity.AddView(ScrollView1, 2%x, 30%y, 96%x, 68%y) 'Sichtbare Linkaabstand, Obenabstand, Breite, Höhe definieren
    For i = 0 To 31 'Relais Anzahl definieren von 0 bis 31 sind 32 Relais
        Dim p As Panel
        p.Initialize("")
        p.Tag = i
        p.LoadLayout("relais1")
        For v = 0 To Relais - 1
            p.GetView(v).Tag = p 'set the panel as the Tag value
        Next
        ScrollView1.Panel.AddView(p, 0, i * 60dip, ScrollView1.Panel.Width, 58dip)
    Next
    
End Sub

Sub Opto_In_ScrollView
    ScrollView2.Initialize(193dip * 10) 'Innere Höhe definieren (nicht sichtbar)
    Activity.AddView(ScrollView2, 2%x, 30%y, 96%x, 68%y) 'Sichtbare Linkaabstand, Obenabstand, Breite, Höhe definieren
    For i = 0 To 31 'Relais Anzahl definieren von 0 bis 31 sind 32 Relais
        Dim p As Panel
        p.Initialize("")
        p.Tag = i
        p.LoadLayout("relais2")
        For v = 0 To p.NumberOfViews - 1
            p.GetView(v).Tag = p 'set the panel as the Tag value
        Next
        ScrollView2.Panel.AddView(p, 0, i * 60dip, ScrollView2.Panel.Width, 58dip)
    Next
    ScrollView2.Visible=False
End Sub

and make
ScrollView2.Visible=False
 
Upvote 0
Top