Hello,
I have a strange situation. I need TabStrip with the same layout more than once (dynamic). I also need the controls, for example the ListView, to be changed per Tab.
Changing the ListView of Tab1 will always change the ListView of the last Tab.
My example:
Try to press the button on Tab1 or Tab2. You will find the Added lines into Tab3.
How can I change this behaviour?
Best regards,
André
I have a strange situation. I need TabStrip with the same layout more than once (dynamic). I also need the controls, for example the ListView, to be changed per Tab.
Changing the ListView of Tab1 will always change the ListView of the last Tab.
My example:
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
#AdditionalJar: com.android.support:support-v4
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private TabStrip1 As TabStrip
Private Page3ListView1 As ListView
Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
TabStrip1.LoadLayout("Page3", "PAGE 1")
For i = 1 To 5
Page3ListView1.AddSingleLine($"Item ${i}"$)
Next
TabStrip1.LoadLayout("Page3", "THIS IS PAGE 2")
For i = 1 To 8
Page3ListView1.AddSingleLine($"Item ${i}"$)
Next
TabStrip1.LoadLayout("Page3", "AND PAGE 3")
For i = 1 To 10
Page3ListView1.AddSingleLine($"Item ${i}"$)
Next
Activity.AddMenuItem("Jump to page 1", "mnu1")
Activity.AddMenuItem("Jump to page 2", "mnu2")
Activity.AddMenuItem("Jump to page 3", "mnu3")
End Sub
Sub mnu1_Click
TabStrip1.ScrollTo(0, True)
End Sub
Sub mnu2_Click
TabStrip1.ScrollTo(1, True)
End Sub
Sub mnu3_Click
TabStrip1.ScrollTo(2, True)
End Sub
Sub TabStrip1_PageSelected (Position As Int)
Log($"Current page: ${Position}"$)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
For i = 1 To 5
Page3ListView1.AddSingleLine($"Item ${i}"$)
Next
End Sub
Try to press the button on Tab1 or Tab2. You will find the Added lines into Tab3.
How can I change this behaviour?
Best regards,
André