Android Question Load layer in HorizontalScrollView does not show my content

trejocode

Member
Licensed User
Longtime User
Hi, I'm practicing with the ScrollViews, but I need help.
I have 1 main screen called: "main.bal" that contains 1 ScrollView and 1 HorizontalScrollView on the same screen.
The first ScrollView works perfectly and loads my layer: "contenido.bal".
My HorizontalScrollView must load "horizontal.bal" the content is loaded, because my activity has the purple background color, but it does not show me the content that corresponds to the "horizontal.bal" layer. Both layers have been adjusted by Script - General, but I just can not load the content in the HorizontalScrollView.
Annex images and project, please wait and help me, I am very confused.
Thank you very much to all.

Main.bal

result.jpg


horizontal.bal

horizontal.jpg



B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private ScrollView1 As ScrollView
    Private PanelContenido As Panel
    Private HorizontalScrollView1 As HorizontalScrollView
    Private PanelHorizontal As Panel
 
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
 
    ScrollView1.Panel.LoadLayout("contenido")
    ScrollView1.Panel.Height = PanelContenido.Height
 
    HorizontalScrollView1.Panel.LoadLayout("horizontal")
    HorizontalScrollView1.Panel.Width = PanelHorizontal.Width
    HorizontalScrollView1.Panel.Height = PanelHorizontal.Height
 
End Sub

Scripts - General de horizontal.bal

B4X:
AutoScaleAll

PanelHorizontal.Width = 200%x
PanelHorizontal.Top = 0
PanelHorizontal.Left = 0
PanelHorizontal.Height = 45%y

Button1.Width = 20%x
Button1.Height = 10%y
Button1.Top = 0
Button1.Left = 0

Panel2.Width = 20%x
Panel2.Height = 10%y
Panel2.Top = 0
Panel2.Left = 90%x


Panel3.Width = 20%x
Panel3.Height = 10%y
Panel3.Top = 0
Panel3.Left = 180%x
 

Attachments

  • ScrollViews.zip
    11.7 KB · Views: 224

klaus

Expert
Licensed User
Longtime User
I suspect that the problem is in the DesignerScript.
I modified a bit the layout to adapt to my device and commented all DesignerScrip for the HorizontalScrollView and it works.
You need to rethink the DesignerScript.

The attached project works on my device.
 

Attachments

  • ScrollViews1.zip
    11.7 KB · Views: 226
Upvote 0

trejocode

Member
Licensed User
Longtime User
I suspect that the problem is in the DesignerScript.
I modified a bit the layout to adapt to my device and commented all DesignerScrip for the HorizontalScrollView and it works.
You need to rethink the DesignerScript.

The attached project works on my device.

Thank you, but i need a solution based in Scripts General :(
Woks fine, but i need a any explication for Scripts in Horizontal ScrollView
 
Upvote 0

trejocode

Member
Licensed User
Longtime User
Check xCustomListView. In most cases it is easier to work with it instead of ScrollView or HorizontalScrollView.
Thanks Erel, but I needed a "native" solution, xCustomLib is for lists? I do not need lists, just complete a design.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is nothing more native in ScrollView compared to xCustomListView. Though it is possible that you should use (Horizontal)ScrollView here directly.

Two tips:
1. It is always the parent view that determines the size for the loaded layout.
2. Never load a layout before you set the parent size (this is not the case in the code from the first post).
 
Upvote 0

trejocode

Member
Licensed User
Longtime User
There is nothing more native in ScrollView compared to xCustomListView. Though it is possible that you should use (Horizontal)ScrollView here directly.

Two tips:
1. It is always the parent view that determines the size for the loaded layout.
2. Never load a layout before you set the parent size (this is not the case in the code from the first post).
There is nothing more native in ScrollView compared to xCustomListView. Though it is possible that you should use (Horizontal)ScrollView here directly.

Two tips:
1. It is always the parent view that determines the size for the loaded layout.
2. Never load a layout before you set the parent size (this is not the case in the code from the first post).

Thanks, it would be interesting to have a revision, including a HorizontalScrollView Bug with respect to the Designer Scripts
 
Upvote 0
Top