Android Question scrollview does not scroll

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:

B4X:
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
 
Top