HorizontalScrollview

mrossen

Active Member
Licensed User
Longtime User
Hi,

Is it possible to use the new HorisontalScrollview to shift page/layout when "swipe finger" ex. to the left. And if yes, can I still use the Scrollview on the pages/layout?

Mogens
 

mrossen

Active Member
Licensed User
Longtime User
Thanks for the tip, Erel,

It works nice, but I want to have Scrollview on each panel. Is this possible?

Mogens
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
Yes, I have my panels sliding.

My problem is how to combine the sliding panels and scrollview.

I would like to have the scrollview on the panels.

I have tried something like this

B4X:
scrollview.panels(0)

But I think I have to have the scrollview in the layout I load?
But also this I dont know to solve.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should modify the layout and add the views to the panels (by loading layout files or by code). The panels are created in this code:
B4X:
   Dim panels(3) As Panel
   For i = 0 To panels.Length - 1
      panels(i).Initialize("panels")
      panels(i).Color = Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255))
      Dim lbl As Label
      lbl.Initialize("")
      lbl.Text = "I'm Panel: " & i
      lbl.TextSize = 20
      lbl.TextColor = Colors.White
      panels(i).AddView(lbl, 20%x, 40%y, 60%x, 30dip)
      Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y - 60dip) 'add the panel to the layout
      Activity.AddMenuItem("Panel #" & i, "Menu")
   Next
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
Hi,

I have still not figured out how to place the panel array in a scrollview

Here is what I try, but the fails with a "no layout loaded"

B4X:
Dim panels(2) As Panel
   
   ScrollViewMain.Initialize(0)
   
   panels(0).Initialize("panels")
   panels(1).Initialize("panels")
      
   panels(0) = ScrollViewMain.Panel
      
   panels(0).LoadLayout("input")
   panels(1).LoadLayout("output")
   
      
   Activity.AddView(panels(0), 100%x, 0, 100%x, 100%y - 80dip) 'add the panel to the layout
   Activity.AddView(panels(1), 100%x, 0, 100%x, 100%y - 80dip) 'add the panel to the layout
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
I have still not figured out how to place the panel array in a scrollview

Dont you mean place the scrollview on the panel array?
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
Sorry. You properly right.

What I want to do is, make my panels to scroll. I can not figure out how to combine this,

Thanks, Mogens
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Changing the code slightly will put a horizontalscrollview on each panel.

You will need to populate it though

B4X:
   Dim panels(3) As Panel
   Dim hsv(3) As HorizontalScrollView
   For i = 0 To panels.Length - 1
      panels(i).Initialize("panels")
      panels(i).Color = Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255))
      hsv(i).Initialize(500, "hsview")
      Dim lbl As Label
      lbl.Initialize("")
      lbl.Text = "I'm Panel: " & i
      lbl.TextSize = 20
      lbl.TextColor = Colors.White
      panels(i).AddView(lbl, 20%x, 40%y, 60%x, 30dip)
      Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y - 60dip) 'add the panel to the layout
      panels(i).AddView(hsv(i),0,0,50%x,50%y)
      Activity.AddMenuItem("Panel #" & i, "Menu")
   Next

You can see it work if you put your finger in the left hand quarter and try to scroll. The scrollview will be scrolling not the panel
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Attached you find two examples , based on Erel's sliding panels example, with horizontal sliding panels and one with a vertical Scrollview on each Panel and the second one with a horizontal Scrollview on each Panel.

Best regards.
 

Attachments

  • SlidingScrollviewPanels.zip
    7.7 KB · Views: 471
  • SlidingHorizScrollviewPanels.zip
    7.8 KB · Views: 664
Last edited:
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Hi Klaus,

He needs help with Sliding panels with HorizontalScrollView on each panel

I have not yet used the HorizontalScrollView yet so i could only advise on the basics of adding the HorizontalScrollView to the panel

regards

Joe
 
Last edited:
Upvote 0
Top