Android Question Horizontal scrollview different layouts

Discussion in 'Android Questions' started by apty, Jan 5, 2019.

  1. apty

    apty Active Member Licensed 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

    Code:
    HorizontalScrollView2.Panel.LoadLayout("pnl1")
    HorizontalScrollView2.Panel.LoadLayout(
    "pnl2")
    Also i have tried:
    Code:
    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
     
  2. Eme Fibonacci

    Eme Fibonacci Well-Known Member Licensed User

    My simple example:
    Code:
    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: Jan 6, 2019
    mangojack likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    Consider using xCustomListView. It will probably be simpler.

    You can configure its orientation.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice