Hi,
I've integrated the AHViewPager slider (http://www.b4x.com/forum/additional...er-library-sliding-panels-now-perfect-10.html) to my app but i have some problems with adding multiple tabs.
The slider works perfect but i'm getting a error on:
I'm adding the pages from a loop and the first and second time when i call the function it works but after that i'm getting the message:
"The specified child already had a parent. You must call removeView() on the child's parent first."
I saw this post but i don't know how to fix it...
Currently this is my code:
The Sub ShowSchema is called when i select a menuitem from my app.
Can someone help me? Thanks!
I've integrated the AHViewPager slider (http://www.b4x.com/forum/additional...er-library-sliding-panels-now-perfect-10.html) to my app but i have some problems with adding multiple tabs.
The slider works perfect but i'm getting a error on:
B4X:
container.AddPage(pan,d.name)
I'm adding the pages from a loop and the first and second time when i call the function it works but after that i'm getting the message:
"The specified child already had a parent. You must call removeView() on the child's parent first."
I saw this post but i don't know how to fix it...
Do you use the whole code snippet in your for/next loop?
Then you get the error because you add the fixedTabs and the pager multiple times to the activity.
Currently this is my code:
B4X:
Sub ShowSchema
Dim in As InputStream
Dim col As ColorDrawable
'Layout
P_LayoutContent.LoadLayout("SchemaLayout")
parser.Initialize
container.Initialize
MyDays.Initialize
in = File.OpenInput(File.DirInternal, "scheme0.dat")
parser.Parse(in, "SchemaParser")
in.Close
'Read list
For i = 0 To MyDays.Size - 1
Dim d As Day
d = MyDays.Get(i)
'Tabs
Dim pan As Panel
pan = CreatePanel(TYPE_LISTVIEW, d.name, d.Activities)
container.AddPage(pan,d.name)
Next
'Now we have a container with our panels just add it to the pager object
pager.Initialize(container, "Pager")
'As we want to show the tabs page indicator, we initialize it
tabs.Initialize(pager)
tabs.LineHeight = 5dip
tabs.UpperCaseTitle = True
P_SchemaContent.AddView(tabs, 0, 0, FILL_PARENT, WRAP_CONTENT)
'We add a line below the tab page indicator because it looks good
col.Initialize(tabs.LineColorCenter, 0)
line.Initialize("")
line.Background=col
P_SchemaContent.AddView(line, 0, 35dip, P_SchemaContent.Width, 2dip)
'Now we can add the pager to the activity
P_SchemaContent.AddView(pager, 0, 35dip + 2dip, P_SchemaContent.Width, P_SchemaContent.Height-48dip-35dip-2dip)
'Thema
tabs.Color = Colors.Black
tabs.BackgroundColorPressed = Colors.Blue
tabs.LineColorCenter = Colors.Green
tabs.TextColor = Colors.LightGray
tabs.TextColorCenter = Colors.Green
line.Color = Colors.Green
End Sub
The Sub ShowSchema is called when i select a menuitem from my app.
Can someone help me? Thanks!