Android Question Trying to understand the scrolling of a ScrollView

Gavin

Member
Licensed User
Longtime User
Hi everyone,
Recently, I downloaded and tried the Table Example. It worked perfectly. I then proceeded to make some changes to suit a simple application I am trying to produce whereby you can enter the given numbers in a Sudoku puzzle from, say, a local newspaper, lock and save these numbers, then complete the puzzle at your leisure. My idea was to produce a fixed 9 by 9 grid with a dividing line in each 3 by 3 block at the top of a Portrait Screen. This I was able to do with out any apparent problems. My aim now is to place 10 buttons (backspace and 0 to 9) plus, say, a button to save the puzzle, a text box and what ever else may be required.
These controls will be placed at the bottom of the screen. My idea is to place the controls on a Scroll View, have the numerical buttons visible and locked while entering numbers in the puzzle the be able to Scroll to the Text Box and Save Button.
In the uploaded file, on the Main Module, you will see, under Sub Activity_Create , 10 lines beginning with Table2.Add_T2 remed out. Simply unrem one at a time and observe the actions of the lower Scroll View. I am adding 14 lines and would like to get all 14 scrolling properly, as in the original Table Example. (No, my project does not need 14 lines, its just an exercise.) Also, note the comments with each of these 10 lines.
Any assistance greatly appreciated but, if possible, no code please, just guidance. I must try to figure this out for myself. The answer is probably staring me in the face.
 

Attachments

  • Blank Sodoko.zip
    10 KB · Views: 238

klaus

Expert
Licensed User
Longtime User
Sorry, but for me you are going the wrong way.
The Table view is really not suited for this application, it is designed for big list of data which can be scrolled.
In your application, for the grid, you don't need any scrolling.
Don't you have enough place on the screen to display everything you need ?
If yes you dont need a scrollview.
If you really want a ScrollView you should define your own, look here for examples.
What exactly do you want to scroll ?

I have programed a Sudoku game where the grid and all its content is drawn with canvases on different layers (panels) and the Touch event of the top layer panel to manage grid events.
And buttons on the bottom of the screen for the other functions.

This thread 'How to write a sudoku solver' might be intersting for you.
 
Upvote 0

Gavin

Member
Licensed User
Longtime User
Thank you Klaus
I simply wanted to have a ScrollView at the bottom of the screen with buttons that were scrollable.
Upon looking at the examples you suggested, I chose the ScrollViewNLayouts example as a platform.
The ScrollView is now working perfectly.
The original problem appears to be with the sizing and positioning of both the ScrollViwe and the Panels. It appears that the panels will only scroll to the edge of the ScrollView (makes sense) so, if the ScrollView is lager than the screen, then not all of the panel/panels will show on the screen. Also, If the panel is larger than required then, when scrolling, the panel will still scroll to the edge of the ScrollView but, there will be no Views on that portion of the panel giving the illusion that something is wrong.
 
Upvote 0
Top