Android Question Need scrolling panel

Scotter

Active Member
Licensed User
Hi -
I see the "scrollview" view.
My issue: It appears you can't set this up in the designer to hold other views.
I see after a search that it can be done programmatically.
However, I really need the ability to set it up in the designer.
Should I give up or is there a custom component available that does this?
Thanks!
 

JohnC

Expert
Licensed User
Longtime User
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You should use xCustomListview. xCustomListview = Scrollview plus additional features.
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
I generally setup my "inner panel" in the designer as its own layout, then at runtime load the layout into the scrollview's panel directly or a containing panel if multiple "rows" need be displayed.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
There are work-arounds/alternatives, but they typically require programmically designing/adding the contents of a scroll view.

But my desire (and I think Scotter's desire too) is that there are many instances in which it would be just so convenient to be able to simply place views within a scrollview using the "designer" just like we can easily add views to a panel.

We all know it is possible to add views and position them in a layout programmically, but the whole reason for adding a visual designer to the IDE is to make that process easier. And it would just be so much easier to be able to place views within a scroll view without the need to programmically do anything.
 
Last edited:
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
but the whole reason for adding a visual designer to the IDE is to make that process easier
As I said in my post, you create your inner layout in the designer visually as desired. The only part missing from your request is that you cannot see the truncated result inside the scrollview container in your main layout. And the only line of code required programmatically is the "Scrollview1.Panel.LoadLayout("InnerPanel")" right after your initial Activity.Loadlayout("MainPanel").
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You need to distinct two objects:
1. ScrollView, which is a vertical scrollview you can add in the Deisigner. You cannot add any views directly on it in the Designer.
The height of the ScrollView must not be heigher than the screen, otherwise not all the content will be displayed.
2. ScrollView.Panel, which is the internal Panel of the ScrollView. You can load onto this Panel any layout like in any 'standard' Panel.
The height of this Panel can be any value and of course heigher the the screen height.
But you need to set this height with ScrollView.Panel.Height = xx.

You may have a look this example: ScrollView example with a Panel higher than the screen.
You can, of course, also use xCustomListView which is a much more versatile view based on a ScrollView.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
I understand all that, and that's what I currently do.

But, I was simply expressing my desire to have Scrollview be a no-brainer to work with without having to:

1) Create a scrollview in a separate layout
2) Create another layout and place views in it
3) Load the first layout, then the second layout, then set the first layouts inner-panel to the height of the second layout

It would just be cool to simply have one layout that I place a scrollview on, then add views inside it. Then simply load the one layout and like magic it will scroll its contents automatically based on the screen size.
 
Upvote 0

Scotter

Active Member
Licensed User
I understand all that, and that's what I currently do.

But, I was simply expressing my desire to have Scrollview be a no-brainer to work with without having to:

1) Create a scrollview in a separate layout
2) Create another layout and place views in it
3) Load the first layout, then the second layout, then set the first layouts inner-panel to the height of the second layout

It would just be cool to simply have one layout that I place a scrollview on, then add views inside it. Then simply load the one layout and like magic it will scroll its contents automatically based on the screen size.

Thank you!!! That IS what I was looking for!
 
Upvote 0
Top