Displaying a Table - scrolling

JaunLukePicard

Member
Licensed User
Longtime User
I am going to create my first Android application. In this application I will create a Subrutine in a Code Module to be called that creates the layout. The layout would be in a Scrollview.

The layout will (or can) be larger then the screen of a SmartPhone both horizontally and vertically. Horizontally due to the size of the columns and vertically due to the number of items to be liated.

So this begs the question - do I use ScrollView or HorizontalScrollView?
Which example would be best for me to use?
Can I use a layout screen that I can build visually or should I use code only?
:sign0085:
 

klaus

Expert
Licensed User
Longtime User
Layouts can be created either with the Designer or by code.
The advantge in the Designer is you see directly the layout and can create different layout variants in the same layout file, by code you have more 'freedom' and the whole control to adapt the layouts to the different resolutions. You can also have a combination of both, create layouts with the Designer and adapt them by code.
The choice between ScrollView or HorizontalScrollView depends on what you want to display and how. ScrollView scrolls only verticaly and HorizontalScrollView only horizontaly.
If you have just a few layouts I woldn't create these in a Code Module but directly in the Activity Module.

You can have a look at:
- the Designer chapter in the Wiki
- the Beginner's Guide.
- the ScrollView examples summary

Best regards.
 
Upvote 0

JaunLukePicard

Member
Licensed User
Longtime User
Displaying a Table

Those links are definately useful. I checked them out earlier, but I will keep them in mind.

I am thinking of using the Designer actually. Now that I have decided that the Designer is the way to go I am thinking that using a Code Module would be best to generate the Header, Body and Buttons. This way I can pass values to the subs and build the desired Layout. Using this approach I can cut down on redundency of building the layouts.
 
Upvote 0

hasanaydin52

Member
Licensed User
Longtime User
Vertical and Horizontal Scroll in a Table

You can do it.

firstly create Horizontalscrollview as full table height and width,
add label controls in it as header columns,
and add ScrollView in HorizontalScrollView near bottom header controls,
and add cell controls in ScrollView.

And, you can scroll left up and right left.
When scroll up,down header row dont move,
When scroll right and left all table moved.

image description
Yellow: HorizontalScrollView
Pink: Header Controls in HorizontalScrollView
DarkGreen: ScrollView in HorizontalScrollView
Green: Cell controls in ScrollView

I hope i can explain it.
 

Attachments

  • ScrollHorizontalAndVertical.JPG
    ScrollHorizontalAndVertical.JPG
    22.2 KB · Views: 358
Last edited:
Upvote 0

Harris

Expert
Licensed User
Longtime User
I would love to see the resulting code. Perhaps this will result in the universal DBGrid Code Module (or lib) many of us have been wishing for....
I wish you well....

Thanks
 
Upvote 0

ErickAsas

Member
Licensed User
Longtime User
Vertical and Horizontal Scroll in a Table

Thank you hasanaydin52.

I tried your recommendation and yes, I was able to create a table with both vertical and horizontal scrolling enabled.

I've attached the revised Scrollview example so that others may be able to also utilize the code.

Best Regards,
:sign0104:
 

Attachments

  • ScrollViewExample.zip
    329.6 KB · Views: 519
Upvote 0
Top