Android Question HorizontalScrollView and Panel

hub73

Active Member
Licensed User
Longtime User
Hi !
i'm searching a way to display a 2*Activity.width panel and horizontal scroll it.

Code: Copy
    Dim MyView as HorizontallScrollView
    MyView.Initialize(Activity.Width, "MyView")
    Panel1.AddView(MyView, 0, 0, Activity.Width*2, 100%y)

What's wrong as i can't horizontal scroll Panel1 (ondesigner Panel1 width is 2 * activity.Width)

Thanks !
 
the inner width should be greater then the outer width if you want to have it scrollable
Code: Copy
Dim MyView as HorizontallScrollView
    MyView.Initialize(Activity.Width * 2, "MyView")
    Panel1.AddView(MyView, 0, 0, Activity.Width, 100%y)
 
Upvote 0
not work. Panel1 is directly on the bal file Borne ehpad_nouveau. Next tabhost is also used. Perhaps not work when tabhost used too ?
Have some others childs panels on my 2*screen wide panel1 and want horizontal scroll them

Code: Copy
    Dim vue  as HorizontallScrollView
    Dim Panel1 as Panel

    (Sub Activity_Create)

...

    Activity.LoadLayout("borne_ehpad_layout_tab")

    TabHost1.AddTab("les textes", "Borne_ehpad_nouveau")
    TabHost1.AddTab("les images", "Borne_layout")
    TabHost1.AddTab("editer l'image", "Borne_ehpad_image")
    TabHost1.AddTab("dongle","Borne_ehpad_dongle")
    TabHost1.AddTab("paramètres", "borne_layout_connexion")


    Vue.Initialize(TabHost1.Width * 2, "vue")
   
    Panel1.AddView(Vue, 0, 0, TabHost1.Width, 100%y)
 
Last edited:
Upvote 0
you don't need the panel1 (panel1 does not affect the scrollview), you can add your scrollview directly:
Code: Copy
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Dim MyView As HorizontalScrollView

End Sub

Sub Activity_Create(FirstTime As Boolean)
  
    'Activity.LoadLayout ("My_layout")
    MyView.Initialize(100dip, "myview")
    Activity.AddView(MyView,0,0,100%x,200dip)
    Dim p1, p2 As Panel
    p1.Initialize("p1")
    p1.Color = Colors.red
    p2.Initialize("p2")
    p2.Color = Colors.blue  
    MyView.Panel.addview(p1,0,0,100dip,100%y)
    MyView.Panel.addview(p2,100dip,0,1500dip,100%y)
    MyView.Panel.Width = p1.Width+p2.Width 'this sets the scrollwidth relative to the activity width

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 
Upvote 0
Many thanks for this code sample eurojam.

I can scroll my panel without problem now, but...

Strange bug is now : can't edit edittext on the panel. i lost the focus when cursor is on the edittext ! (focus go to my tabhost first item and no text appear !)
 
Last edited:
Upvote 0
Back
Top