Can someone suggest how to have two layouts loaded in the same panel under scrollview?
What I want to achieve is loading 2 layout files (each contains panel --> that contains some buttons and labels) on a panel under each other, sure the command below show them on the same position so they appear over each other.
Thank you for your help!
B4X:
Dim p As Panel
p.Initialize("")
p.SetLayout(0,30dip,100%x,210dip)
ScrollView1.Panel.AddView(p,0,0dip,100%x,210dip)
p.LoadLayout("view1")
p.LoadLayout("view2")
@AymanA you should load one layout and use 2 panels to get the results that you are looking for. You can easily switch between the two panels.
But saying that, if you really do need 2 layout files, then you should be using 2 activities, especially as it will make managing your code a lot easier to achieve.
BTW, you have not really explained what you are actually trying to achieve...
[Take a look also to CLVExpandable, maybe it's for you]
[EDIT] I hope it's because of this night time... you want to use a ScrollView and I used a xCustomListView!
Well, if needed, you can change it easily.
[P.S. Attached also a bad ScrollView version]
[Take a look also to CLVExpandable, maybe it's for you]
[EDIT] I hope it's because of this night time... you want to use a ScrollView and I used a xCustomListView!
Well, if needed, you can change it easily.
[P.S. Attached also a bad ScrollView version]
I don't know what your activity should be and why you want or need to use a ScrollView (or a CustomListView).
1 - two panels, added directly to the Activity, may be sufficient;
2 - you may need only two panels but very high, whose sum of heights is greater than that of the screen. In this case a ScrollView is the ideal choice;
3- if you need N pairs of panels, CustomListView is the view to use.
Attached you find a very simple ScrollView example with two Panels.
For simple layouts or lists I prefer ScrollViews.
It has three layout files, the main layout with the ScrollView and one layout for each Panel.
The code is very simple:
B4X:
Sub Globals
Private scvTest As ScrollView
Private pnlTest1, pnlTest2 As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
scvTest.Panel.LoadLayout("Panel1")
scvTest.Panel.LoadLayout("Panel2")
pnlTest2.Top = pnlTest1.Height
scvTest.Panel.Height = pnlTest1.Height + pnlTest2.Height
End Sub