Android Question Need help with using ScrollView

Discussion in 'Android Questions' started by trueboss323, Feb 24, 2015.

  1. trueboss323

    trueboss323 Active Member Licensed User

    Hi all,
    I am trying to write several paragraphs of labels inside a Scrollview which instruct the user how to use the app. But i cannot get the Scrollview to work properly. Can anyone help me? I am doing this all in the designer by the way.
     
  2. eurojam

    eurojam Well-Known Member Licensed User

    can you post your Code or attach it (IDE: File->Exportas Zip)?
     
  3. trueboss323

    trueboss323 Active Member Licensed User

    I also am using the StdActionBar library to display tabs. So obviously, I would like this to be loaded in the "Help" tab.
    Code:
    Private bar As StdActionBar
        
    Private vp As StdViewPager
    Dim ScrollView1 As ScrollView


    vp.Initialize(
    "vp"5100%x100%y)



      
        
    Activity.AddView(vp.AsView, 00100%x100%y)

    bar.AddTab(
    "Main")
    bar.AddTab(
    "Stats")
    bar.AddTab(
    "Options")
    bar.AddTab(
    "Help & About")
        bar.SelectedIndex = currentPage
    vp.Panels(
    0).LoadLayout("Main")
        vp.Panels(
    1).LoadLayout("Stats")
        vp.Panels(
    2).LoadLayout("Options")
        vp.Panels(
    3).LoadLayout("Help")
      
    bar.Initialize(
    "bar")
        bar.NavigationMode = bar.NAVIGATION_MODE_TABS
        
    ' Add help Scrollview
        ScrollView1.Panel.LoadLayout("Help")
     
  4. HotShoe

    HotShoe Well-Known Member Licensed User

    You might have a look at this:

    http://www.b4x.com/android/forum/threads/class-helpreader.25853/#content

    --- Jem
     
  5. trueboss323

    trueboss323 Active Member Licensed User

    That actually looks pretty good. But I do not need the top navigation buttons, since I only just need to load 1 file, and I would like to integrate the helpviewer inside the tab.
     
  6. eurojam

    eurojam Well-Known Member Licensed User

    I think you have to add your scrollview to the tab first:
    Code:
    ...
    ScrollView1.Initialize(
    400dip)
    vp.panels(
    3).AddView(ScrollView1,0,0,100%x,100%y)
    ScrollView1.SetLayout(
    "Help")
    ...
    Just a suggestion, not tested.

    stefan
     
  7. trueboss323

    trueboss323 Active Member Licensed User

    I changed your code to
    Code:
    ScrollView1.Initialize(400dip)
    vp.Panels(
    3).AddView(ScrollView1,0,0,100%x,100%y)
    ScrollView1.Panel.LoadLayout(
    "Help")
    I could get the panel to load in the tab, but it won't scroll. Not sure if this is a designer problem or a coding problem.
     
  8. eurojam

    eurojam Well-Known Member Licensed User

    This is because of the
    Code:
    ScrollView1.Initialize(400dip)
    where the 400dip sets the height of the inner scrollpannel. If it will be less then the scrollpanelheight, there will be no scrolling...so set the inner height in relation to the views which you will have on the scrollviewpanel (depending from your layout)

    regards
    stefan
     
  9. klaus

    klaus Expert Licensed User

    How is your Help layout defined ?
    Could you post a small project so we could look at it and test it ?
     
Loading...
  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