Hello folks,
I am very new to Android, so forgive me if I sound like a complete newbie - it's because I am one.:sign0104: In addition, I don't know Java, so this IDE was the natural choice. I do know several dialects of Basic, though.
I am trying to design an app which presents the user with a column of vertically arranged buttons. I did that with the Designer and it looked OK there, but when I put the app on a real phone, the phone's screen turned out to be smaller and some of the buttons were not visible. So, I guess I need to implement a scrollable view. Unfortunately, all attempts to do so have failed.
This is what I have done so far:
With the Designer, I have created a Panel. I have also created the Buttons, with the Panel being the parent of each one of them. I guess that should put them on the Panel. I have also created a ScrollView, the parent of which is the main Activity.
It is my understanding that it is not possible to specify in the Designer that the parent of the Panel is the ScrollView, so I have specified that the parent of the Panel is the main Activity.
Is this design correct so far?
And how do I support it programmatically? I tried something like this:
but it doesn't work. What am I doing wrong? I've tried reading the various ScrollView examples, but most of them are way too complicated for my current level of knowledge and I couldn't isolate the parts that are strictly related to my current problem.
I am very new to Android, so forgive me if I sound like a complete newbie - it's because I am one.:sign0104: In addition, I don't know Java, so this IDE was the natural choice. I do know several dialects of Basic, though.
I am trying to design an app which presents the user with a column of vertically arranged buttons. I did that with the Designer and it looked OK there, but when I put the app on a real phone, the phone's screen turned out to be smaller and some of the buttons were not visible. So, I guess I need to implement a scrollable view. Unfortunately, all attempts to do so have failed.
This is what I have done so far:
With the Designer, I have created a Panel. I have also created the Buttons, with the Panel being the parent of each one of them. I guess that should put them on the Panel. I have also created a ScrollView, the parent of which is the main Activity.
It is my understanding that it is not possible to specify in the Designer that the parent of the Panel is the ScrollView, so I have specified that the parent of the Panel is the main Activity.
Is this design correct so far?
And how do I support it programmatically? I tried something like this:
B4X:
Sub Globals
Dim MainPanel As Panel
Dim MainScrollView As ScrollView
End Sub
Sub Activity_Create (FirstTime As Boolean)
Activity.LoadLayout ("ASS")
MainPanel.Initialize ("MainPanel")
MainScrollView.Initialize (420)
Activity.AddView (MainScrollView, 0, 0, 100%x, 100%y)
MainPanel.RemoveView
MainScrollView.Panel.AddView (MainPanel, 0, 0, MainScrollView.Width, MainScrollView.Panel.Height)
End Sub
but it doesn't work. What am I doing wrong? I've tried reading the various ScrollView examples, but most of them are way too complicated for my current level of knowledge and I couldn't isolate the parts that are strictly related to my current problem.