Using Designer & Tabhost & Scrollview & Edit view

devjet

Member
Licensed User
Longtime User
Using Designer & Tabhost & Scrollview & Edit view
I have been doing a layout where I added a whole bunch of edit views vertically listed. The screen is now a bit too crowded and I like to expand it to scroll vertically. I used the designer to add fields. How can I expand it in to a scrolling screen?
I have tried to combine the Tabhost sample with the ScrollViewBigPanel.zip sample but so far without success.... is this possible?

See here
 

devjet

Member
Licensed User
Longtime User
Thanks Erel, does that also work when the scroll view is set bellow a Tabhost view...... when adding a Tabhost the comment says it has to be added grammatically. If anyone has a sample would be nice.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
I don't know if this will help or not, but what I did to make a scrollable view was first I created 3 panels in a new layout called "ScrollViewPanels" for this sample. Then I edited them as needed, moved them out of my way as needed, etc. This made it easier to manage all of the information that will go in it without being able to literally scroll through it at design-time.


Then use the following code to put them all together into a scrollview at run-time:

B4X:
Sub Globals
  Dim scvMain As ScrollView
  Dim PanelTop as Panel [COLOR="SeaGreen"]' A panel created in the "ScrollViewPanels" layout.[/COLOR]
  Dim PanelMid As Panel  [COLOR="SeaGreen"]' A panel created in the "ScrollViewPanels" layout.[/COLOR]
  Dim PanelBottom As Panel  [COLOR="SeaGreen"]' A panel created in the "ScrollViewPanels" layout.[/COLOR]
End Sub


[COLOR="SeaGreen"]' Call this sub to initialize the view rather than a simple activity.LoadLayout ("ScrollViewPanels").[/COLOR]

Sub InitScrollingView
   Dim Panel0 As Panel
   scvMain.Initialize (1180dip) [COLOR="SeaGreen"]' Determine appropriate height of scrolling area
' Note this number needs to be tweaked depending on your height requirements![/COLOR]

   Activity.AddView(scvMain,0,0,100%x,100%y)

   Panel0=scvMain.Panel
   Panel0.Color=Colors.Black

        panel0.LoadLayout ("ScrollViewPanels") [COLOR="SeaGreen"]' contains PanelTop, PanelMid and PanelBottom[/COLOR]

 [COLOR="SeaGreen"]' Fix the coordinates since we don't really know how we left it when working on it in the designer....[/COLOR]
        PanelTop.Top = 0
        PanelTop.Left = 0:PanelTop.Width = Panel0.Width

   PanelMid.Top = PanelTop.Top + PanelTop.Height + 10[COLOR="SeaGreen"] ' Set mid panel 10 pix below bottom of TOP panel[/COLOR]
   PanelMid.Left = 0:PanelMid.Width = Panel0.Width

        PanelBottom.Top = PanelMid.Top + panelMid.Height + 10[COLOR=SeaGreen]  ' Set mid panel 10 pix below bottom of TOP panel[/COLOR]
   PanelBottom.Left = 0:PanelBottom.Width = Panel0.Width

End Sub

Note though that these numbers likely need to be changed to account for tablets that have soft menus on the bottom or side.

I'm still learning too! I do think this may help get you started though.
 
Upvote 0

devjet

Member
Licensed User
Longtime User
Thank you Erel & Kevin! I have done the tab tutorial but in combination with the Designer I had a problem to combine the form fields . Anyway I will follow your hints and see how it workes Many thanks !
 
Upvote 0
Top