Android Question Why isn't this CustomListView 'Scrollable'

Discussion in 'Android Questions' started by Rob Rendle, May 3, 2015.

  1. Rob Rendle

    Rob Rendle Member Licensed User

    I like making new words :)

    In my project, I have 2 CustomListViews, the panels / labels get changed depending on what the user presses on. One of these lists works fine - it shows the results of the SQL Query and you can scroll through them.

    However, the second one isn't, I've added the Panels / Labels manually, however I can't scroll down to see the rest of the list. You can see about 50% of the Process Label and nothing below. Here is the code :-

    Code:
    Sub FillInfo

    ICV.Clear

    Dim vesqltext As String
    Dim ctsqltext As String
    Dim casqltext As String
    Dim spsqltext As String
    Dim ingsqltext As String
    Dim cpsqltext As String
    Dim cur As Cursor



    vesqltext  = 
    "SELECT VE FROM Rec WHERE NAME = '" & Results.RCVValue & "'"
    ctsqltext  = 
    "SELECT CT FROM Rec WHERE NAME = '" & Results.RCVValue & "'"
    casqltext  = 
    "SELECT CA FROM Rec WHERE NAME = '" & Results.RCVValue & "'"
    spsqltext  = 
    "SELECT SP FROM Rec WHERE NAME = '" & Results.RCVValue & "'"
    ingsqltext = 
    "SELECT ING FROM Rec WHERE NAME = '" & Results.RCVValue & "'"
    cpsqltext  = 
    "SELECT PRO FROM Rec WHERE NAME = '" & Results.RCVValue & "'"


     

    'Get Vegetarian Info'

        cur = SQL1.ExecQuery(vesqltext)

        
    For i = 0 To cur.RowCount -1
        cur.Position = i

        
    Dim IAIVPNL As Panel
        IAIVPNL.Initialize(
    "")
        IAIVPNL.Color = 
    Colors.White
     
        
    Dim IAIVLBL As Label
        IAIVLBL.Initialize(
    "")
        IAIVLBL.Gravity = 
    Gravity.TOP
        IAIVLBL.Text = 
    "Vegetarian ="
        IAIVLBL.TextColor = 
    Colors.Black
        IAIVLBL.TextSize = 
    15
        IAIVLBL.Color = 
    Colors.Transparent
        IAIVLBL.Typeface = myFont
     
        
    Dim IAIVResLBL As Label
        IAIVResLBL.Initialize(
    "")
        IAIVResLBL.Gravity = 
    Gravity.TOP
        IAIVResLBL.Text = cur.GetString(
    "VE")
        IAIVResLBL.TextColor = 
    Colors.Black
        IAIVResLBL.TextSize = 
    15
        IAIVResLBL.Typeface = myFont
        
    Next
        
    If IAIVResLBL.Text = ("null"Then
        IAIVResLBL.Text = (
    "No")
        
    End If
        
    If IAIVResLBL.Text = ("V"Then
        IAIVResLBL.Text = (
    "yes")
        
    End If
     
        IAIVPNL.AddView(IAIVLBL,
    10dip,10dip,100dip,100dip)
        IAIVPNL.AddView(IAIVResLBL,
    110dip,10dip,100dip,100dip)
     
        ICV.Add(IAIVPNL,
    40dip, cur.GetString("VE"))
     
    'Get Cooking Time Info'

        cur = SQL1.ExecQuery(ctsqltext)

        
    For i = 0 To cur.RowCount -1
        cur.Position = i

        
    Dim CTIAIVPNL As Panel
        CTIAIVPNL.Initialize(
    "")
        CTIAIVPNL.Color = 
    Colors.White
     
        
    Dim CTIAIVLBL As Label
        CTIAIVLBL.Initialize(
    "")
        CTIAIVLBL.Gravity = 
    Gravity.TOP
        CTIAIVLBL.Text = 
    "Cooking Time (In Minutes) ="
        CTIAIVLBL.TextColor = 
    Colors.Black
        CTIAIVLBL.TextSize = 
    15
        CTIAIVLBL.Color = 
    Colors.Transparent
        CTIAIVLBL.Typeface = myFont
     
        
    Dim CTIAIVResLBL As Label
        CTIAIVResLBL.Initialize(
    "")
        CTIAIVResLBL.Gravity = 
    Gravity.TOP
        CTIAIVResLBL.Text = cur.GetString(
    "CT")
        CTIAIVResLBL.TextColor = 
    Colors.Black
        CTIAIVResLBL.TextSize = 
    15
        CTIAIVResLBL.Typeface = myFont
        
    Next
        
    If CTIAIVResLBL.Text = ("null"Then
        CTIAIVResLBL.Text = (
    "Unkown")
        
    End If
     
        CTIAIVPNL.AddView(CTIAIVLBL,
    10dip,10dip,250dip,100dip)
        CTIAIVPNL.AddView(CTIAIVResLBL,
    240dip,10dip,100dip,100dip)
     
     
        ICV.Add(CTIAIVPNL,
    40dip, cur.GetString("CT"))
     
    'Get Calorie Info'

        cur = SQL1.ExecQuery(casqltext)
     
        
    For i = 0 To cur.RowCount -1
        cur.Position = i

        
    Dim CAIAIVPNL As Panel
        CAIAIVPNL.Initialize(
    "")
        CAIAIVPNL.Color = 
    Colors.White
     
        
    Dim CAIAIVLBL As Label
        CAIAIVLBL.Initialize(
    "")
        CAIAIVLBL.Gravity = 
    Gravity.TOP
        CAIAIVLBL.Text = 
    "Calories ="
        CAIAIVLBL.TextColor = 
    Colors.Black
        CAIAIVLBL.TextSize = 
    15
        CAIAIVLBL.Color = 
    Colors.Transparent
        CAIAIVLBL.Typeface = myFont
     
        
    Dim CAIAIVResLBL As Label
        CAIAIVResLBL.Initialize(
    "")
        CAIAIVResLBL.Gravity = 
    Gravity.TOP
        CAIAIVResLBL.Text = cur.GetString(
    "CA")
        CAIAIVResLBL.TextColor = 
    Colors.Black
        CAIAIVResLBL.TextSize = 
    15
        CAIAIVResLBL.Typeface = myFont
        
    Next
        
    If CAIAIVResLBL.Text = ("null"Then
        CAIAIVResLBL.Text = (
    "Unkown")
        
    End If
     
        CAIAIVPNL.AddView(CAIAIVLBL,
    10dip,10dip,100dip,100dip)
        CAIAIVPNL.AddView(CAIAIVResLBL,
    110dip,10dip,100dip,100dip)
     
        ICV.Add(CAIAIVPNL,
    40dip, cur.GetString("CA"))
     
    'Get Special Info'


        cur = SQL1.ExecQuery(spsqltext)
     
        
    For i = 0 To cur.RowCount -1
        cur.Position = i

        
    Dim SPIAIVPNL As Panel
        SPIAIVPNL.Initialize(
    "")
        SPIAIVPNL.Color = 
    Colors.White
     
        
    Dim SPIAIVLBL As Label
        SPIAIVLBL.Initialize(
    "")
        SPIAIVLBL.Gravity = 
    Gravity.TOP
        SPIAIVLBL.Text = 
    "Special Info ="
        SPIAIVLBL.TextColor = 
    Colors.Black
        SPIAIVLBL.TextSize = 
    15
        SPIAIVLBL.Color = 
    Colors.Transparent
        SPIAIVLBL.Typeface = myFont
     
        
    Dim SPIAIVResLBL As Label
        SPIAIVResLBL.Initialize(
    "")
        SPIAIVResLBL.Gravity = 
    Gravity.TOP
        SPIAIVResLBL.Text = cur.GetString(
    "SP")
        SPIAIVResLBL.TextColor = 
    Colors.Black
        SPIAIVResLBL.TextSize = 
    15
        SPIAIVResLBL.Typeface = myFont
        
    Next
        
    If SPIAIVResLBL.Text = ("null"Then
        SPIAIVResLBL.Text = (
    "Unkown")
        
    End If
     
        SPIAIVPNL.AddView(SPIAIVLBL,
    10dip,10dip,100dip,100dip)
        SPIAIVPNL.AddView(SPIAIVResLBL,
    150dip,10dip,100dip,100dip)
     
        ICV.Add(SPIAIVPNL,
    40dip, cur.GetString("SP"))
     
    'Get Ingredients'
     
        cur = SQL1.ExecQuery(ingsqltext)
     
        
    For i = 0 To cur.RowCount -1
        cur.Position = i

        
    Dim INGIAIVPNL As Panel
        INGIAIVPNL.Initialize(
    "")
        INGIAIVPNL.Color = 
    Colors.White
     
        
    Dim INGIAIVLBL As Label
        INGIAIVLBL.Initialize(
    "")
        INGIAIVLBL.Gravity = 
    Gravity.CENTER_VERTICAL
        INGIAIVLBL.Text = cur.GetString(
    "ING")
        INGIAIVLBL.TextColor = 
    Colors.Black
        INGIAIVLBL.TextSize = 
    15
        INGIAIVLBL.Color = 
    Colors.Transparent
        INGIAIVLBL.Typeface = myFont
        
    Next
     
        INGIAIVPNL.AddView(INGIAIVLBL,
    10dip,10dip,90%x,2000dip)
     
        
    Dim su As StringUtils
        INGIAIVLBL.Height = su.MeasureMultilineTextHeight(INGIAIVLBL, INGIAIVLBL.Text) + 
    40dip
        
    Log(INGIAIVLBL.Height)
     
        ICV.Add(INGIAIVPNL,INGIAIVLBL.Height, cur.GetString(
    "ING"))
     
        INGIAIVPNL.Height = su.MeasureMultilineTextHeight(INGIAIVLBL, INGIAIVLBL.Text) + 
    40dip
        
    Log(INGIAIVPNL.Height)
     
     
     
    'Get Cooking Process'

        cur = SQL1.ExecQuery(cpsqltext)
     
        
    For i = 0 To cur.RowCount -1
        cur.Position = i

        
    Dim CPIAIVPNL As Panel
        CPIAIVPNL.Initialize(
    "")
        CPIAIVPNL.Color = 
    Colors.White
     
        
    Dim CPIAIVLBL As Label
        CPIAIVLBL.Initialize(
    "")
        CPIAIVLBL.Gravity = 
    Gravity.CENTER_VERTICAL
        CPIAIVLBL.Text = cur.GetString(
    "PRO")
        CPIAIVLBL.TextColor = 
    Colors.Black
        CPIAIVLBL.TextSize = 
    15
        CPIAIVLBL.Color = 
    Colors.Transparent
        CPIAIVLBL.Typeface = myFont
        
    Next
     
        CPIAIVPNL.AddView(CPIAIVLBL,
    10dip,10dip,90%x,2000dip)
     
        
    Dim su As StringUtils
        CPIAIVLBL.Height = su.MeasureMultilineTextHeight(CPIAIVLBL, CPIAIVLBL.Text) + 
    80dip
        
    Log(CPIAIVLBL.Height)
     
        ICV.Add(CPIAIVPNL,CPIAIVLBL.Height, cur.GetString(
    "PRO"))
     
        CPIAIVPNL.Height = su.MeasureMultilineTextHeight(CPIAIVLBL, CPIAIVLBL.Text) + 
    80dip
        
    Log(CPIAIVPNL.Height)
     
    'Favourites Button'
     
        
    Dim FAVIAIVPNL As Panel
        FAVIAIVPNL.Initialize(
    "")
        FAVIAIVPNL.Color = 
    Colors.White
     
        
    Dim FAVIAIVLBL As Label
        FAVIAIVLBL.Initialize(
    "")
        FAVIAIVLBL.Gravity = 
    Gravity.CENTER_VERTICAL
        FAVIAIVLBL.Text = 
    "Press here to add this recipe to your favourites list"
        FAVIAIVLBL.TextColor = 
    Colors.Black
        FAVIAIVLBL.TextSize = 
    15
        FAVIAIVLBL.Color = 
    Colors.Transparent
        FAVIAIVLBL.Typeface = myFont
     
        FAVIAIVPNL.AddView(FAVIAIVLBL,
    10dip,10dip,100%x,100dip)
        ICV.Add(FAVIAIVPNL,
    40dip"ATF")

    End Sub
    Any clues as to why the Cooking Process label only shows about 50% of the text and Favourite Label doesn't show at all (you can't scroll down to it)? In the designer this CustomListView is identical the other which works (the other CLV is on a different module)

    Thank you :)
     
    Last edited: May 3, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    Hard to say without running the code. Maybe you are adding less items then you expect?
     
  3. Rob Rendle

    Rob Rendle Member Licensed User

    See last post for fix :)
     
    Last edited: May 11, 2015
  4. walterf25

    walterf25 Well-Known Member Licensed User

    I have not run your code, but based on my experience with Custom List View, i would suggest you check if you are resizing the scrollview panel's height to the height of all your items in the list.

    Cheers,
    Walter
     
    Rob Rendle likes this.
  5. Rob Rendle

    Rob Rendle Member Licensed User

    Walter - found how to do this and it worked.

    I won't take credit for the fix, it was posted by a user Tunderin :-

    This fixed two problems in one go too.

    Thanks again :)
     
    Last edited: May 11, 2015
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