Android Question Alternative B4X for HorizontalScrollView

vecino

Well-Known Member
Licensed User
Longtime User
Hi, so, what can I use to replace a HorizontalScrollView, which also allows to add panels, images, labels, buttons, etc. and also allows horizontal scroll.
Thank you.
 

vecino

Well-Known Member
Licensed User
Longtime User
Just a little question: WHY? šŸ˜®
Anyway you can use CustomListView, setting "List orientation" to Horizontal
Because I want to try another view.
It's just that "weird" things happen, although it's probably because I'm not using it correctly.
For example, why this "height= -1" ?
This is a reduced code, I have deleted a lot of things so as not to confuse:

Captura.png

B4X:
Sub CargarFamilias2 As ResumableSub
    Dim const cSql As String = $"select codigo, nombre from tbFamilias where length(nombre)>0 order by codigo"$  
    Dim iItemAncho=160, iTextSize=iItemAnchoCata As Int  
    Dim QG As Cursor  
   
    iTextSize = 18  
   
    hsvFamilias.Panel.RemoveAllViews
   
    QG = globales.DBconex.ExecQuery( cSql )
    hsvFamilias.Panel.Width = (iItemAncho * QG.RowCount)
       
    For i=0 To QG.RowCount-1
        QG.Position = i
       
        Dim btFa As Button
        btFa.Initialize("btFa")              
        btFa.TextSize = iTextSize          
        btFa.Text = QG.GetString("nombre").Trim
                   
        hsvFamilias.Panel.AddView( btFa, iItemAncho*i, 0, iItemAncho,    hsvFamilias.Panel.Height )      
    Next
    If QG.IsInitialized Then QG.Close
    '
    Return Null
End Sub
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
But the panel has 500 by default, as far as I know. Because you have deleted what is contained in the panel, but you don't delete the panel.
And the button (each button) that I add, what is its height, if I have not indicated any?
The thing is that if I want to know later how high is the button, or a label, it tells me zero, when it is not.
Surely I am not doing something right.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Thank you, friends, I have solved it this way:
B4X:
hsvFamilias.Panel.AddView( btFa, iItemAncho*i, 0, iItemAncho, hsvFamilias.Height ) '.Panel.Height )
Now another question arises for me, but I will create a new thread for it.
Thank you very much!!!
 
Upvote 0
Top