1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question Load layer in HorizontalScrollView does not show my content

Discussion in 'Android Questions' started by trejocode, Apr 13, 2019.

  1. trejocode

    trejocode Member Licensed 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.





    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:
        ScrollView1.Panel.Height = PanelContenido.Height
        HorizontalScrollView1.Panel.Width = PanelHorizontal.Width
        HorizontalScrollView1.Panel.Height = PanelHorizontal.Height
    End Sub
    Scripts - General de horizontal.bal


    PanelHorizontal.Width = 
    PanelHorizontal.Top = 
    PanelHorizontal.Left = 
    PanelHorizontal.Height = 

    Button1.Width = 
    Button1.Height = 
    Button1.Top = 
    Button1.Left = 

    Panel2.Width = 
    Panel2.Height = 
    Panel2.Top = 
    Panel2.Left = 

    Panel3.Width = 
    Panel3.Height = 
    Panel3.Top = 
    Panel3.Left = 

    Attached Files:

  2. klaus

    klaus Expert Licensed 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.

    Attached Files:

    Erel and trejocode like this.
  3. trejocode

    trejocode Member Licensed User

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

    Erel Administrator Staff Member Licensed User

    Check xCustomListView. In most cases it is easier to work with it instead of ScrollView or HorizontalScrollView.
  5. trejocode

    trejocode Member Licensed User

    Thanks Erel, but I needed a "native" solution, xCustomLib is for lists? I do not need lists, just complete a design.
  6. Erel

    Erel Administrator Staff Member Licensed 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).
  7. trejocode

    trejocode Member Licensed User

    Thanks, it would be interesting to have a revision, including a HorizontalScrollView Bug with respect to the Designer Scripts
  8. Erel

    Erel Administrator Staff Member Licensed User

    I don't see any bug here. As I wrote, your code is wrong.
  9. trejocode

    trejocode Member Licensed User

    Well, thanks only for your time
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice