Android Question scrollview does not scroll

Discussion in 'Android Questions' started by Sarah.M, Feb 11, 2018.

  1. Sarah.M

    Sarah.M New Member

    Hi
    I am trying to create a menu including 6 labels and 6 images which the total height of these 6 labels are more than the screen's height so i'd like to have a scrolling view starting from the 20%y, so i have used "scrollview" but the problem is after adding the views to the scrollview and setting the top and bottom and running the program on NOX, the labels' positions are not the one i've set and the view does not scroll.
    i have searched for the same problem a lot but the answers did not help me.
    i'll appreciate if any one can help this.
    this is my code:

    Code:
    Sub Globals
        
    Dim scrollview1 As ScrollView
        
    Private Label1 As Label
        
    Private ImageView1 As ImageView
        
    Private Label2 As Label
        
    Private ImageView2 As ImageView
        
    Private Label3 As Label
        
    Private ImageView3 As ImageView
        
    Private Label4 As Label
        
    Private ImageView4 As ImageView
        
    Private Label5 As Label
        
    Private ImageView5 As ImageView
        
    Private Label6 As Label
        
    Private ImageView6 As ImageView
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    Activity.LoadLayout("menuscrolling")
        scrollview1.Top=
    20%y
        scrollview1.Height=
    120%y
        
        Label1.RemoveView()
        scrollview1.Panel.AddView(Label1,
    0%x,0%y,100%x,15%y)
        ImageView1.RemoveView()
        scrollview1.Panel.AddView(ImageView1,
    1%x,1%y,14%x,13%y)
        
        
        Label2.RemoveView()
        scrollview1.Panel.AddView(Label2,
    0%x,Label1.Top+20%x,100%x,15%y)
        ImageView2.RemoveView()
        scrollview1.Panel.AddView(ImageView2,
    1%x,ImageView1.Top+20%y,14%x,13%y)
        
        Label3.RemoveView()
        scrollview1.Panel.AddView(Label3,
    0%x,Label2.Top+20%x,100%x,15%y)
        ImageView3.RemoveView()
        scrollview1.Panel.AddView(ImageView3,
    1%x,ImageView2.Top+20%y,14%x,13%y)
        
        Label4.RemoveView()
        scrollview1.Panel.AddView(Label4,
    0%x,Label3.Top+20%x,100%x,15%y)
        ImageView4.RemoveView()
        scrollview1.Panel.AddView(ImageView4,
    1%x,ImageView3.Top+20%y,14%x,13%y)
        
        Label5.RemoveView()
        scrollview1.Panel.AddView(Label5,
    0%x,Label4.Top+20%x,100%x,15%y)
        ImageView5.RemoveView()
        scrollview1.Panel.AddView(ImageView5,
    1%x,ImageView4.Top+20%y,14%x,13%y)
        
        Label6.RemoveView()
        scrollview1.Panel.AddView(Label6,
    0%x,Label5.Top+20%x,100%x,15%y)
        ImageView6.RemoveView()
        scrollview1.Panel.AddView(ImageView6,
    1%x,ImageView5.Top+20%y,14%x,13%y)
        
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    This is not the correct way to create a list. You should use CustomListView instead.
     
  3. Sarah.M

    Sarah.M New Member

    thanks for your reply.
    would you help me which video you meant?
    because i couldn't find "CustomListView"
     
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. Sarah.M

    Sarah.M New Member

    Many thanks for your help.
     
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