Android Question Horizontal scrollview different layouts

apty

Active Member
Licensed User
Longtime User
I have two completely different layouts that i want to load into a horizontal scrollview. How can i do this. If i try loading them as below, it only loads one layout

B4X:
HorizontalScrollView2.Panel.LoadLayout("pnl1")
HorizontalScrollView2.Panel.LoadLayout("pnl2")

Also i have tried:
B4X:
Dim pnlsc As Panel
    pnlsc.Initialize("")
    pnlsc.LoadLayout("pnl1")
    Dim pnlsc2 As Panel
    pnlsc2.Initialize("")
    pnlsc2.LoadLayout("pnl2")
HorizontalScrollView2.Panel.AddView(pnlsc2,0dip,0dip,HorizontalScrollView2.Width,HorizontalScrollView2.Height)   

HorizontalScrollView2.Panel.AddView(pnlsc,Activity.width+10dip,0dip,HorizontalScrollView2.Width,HorizontalScrollView2.Height)

Both the codes don't work
 

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
My simple example:
B4X:
Activity.LoadLayout("mainlayout") 'Mainlayout has a HorizontalScrollView with 100%x and 100%y
 
Dim panel1,panel2 As Panel
panel1.Initialize("")
panel2.Initialize("")
 
HorizontalScrollView1.Panel.Width=200%x 'My HorizontalScrollView panel has 200%x
 
HorizontalScrollView1.Panel.AddView(panel1,0,0,100%x,100%y) 'Add first panel: Left=0
HorizontalScrollView1.Panel.AddView(panel2,100%x,0,100%x,100%y) 'Add second panel: left=100%x
 
panel1.LoadLayout("firstlayout") 'Load first layout
panel2.LoadLayout("secondlayout") 'Load second layout
 
Last edited:
Upvote 0
Top