Ho 3 layout:
Funziona tutto, ma ho un solo problema.
Mi piacerebbe tanto che la CustomListView fosse centrata verticalmente all'interno del pnlSplash.
Dopo innumerevoli tentativi, sono riuscito ad ottenere:
Nessuno dei due è elegante. Il primo è un obbrobrio a vedersi, il secondo non è il massimo dal punto di vista della programmazione.
Qualcuno ha qualche idea?
Grazie!
- quello della MainPage
- quello del panel/pane (definito come B4XView e che chiamo "pnlSplash") in cui carico un layout in cui c'è la sola CustomListView
- quello in cui ci sono le view che compongono il singolo item della CustomListView
Funziona tutto, ma ho un solo problema.
Mi piacerebbe tanto che la CustomListView fosse centrata verticalmente all'interno del pnlSplash.
Dopo innumerevoli tentativi, sono riuscito ad ottenere:
- che dopo una frazione di secondo questa si "teleporta" dall'alto al centro ma con un lag.
- aggiungerla dentro un pnlSplash2 a sua volta aggiunto dentro pnlSplash e impostando la proprietà top di pnlSplash2.
B4X:
Private Sub LoadlayCLV(myPnl As B4XView)
' ***********************************************
' Here there is an issue to center vertically the CustomListView1:
' The code in "Else" makes CustomListView1 lagging, also in Release.
' the pnlSplash is added to MainPage by SetpnlSplash sub
' ***********************************************
Dim myynDoppioPnl As Boolean = False ' Variable for DEBUG
If myynDoppioPnl Then ' If myynDoppioPnl is true then add the CLV not directly to pnlSplash but to another panel within the pnlSplash
Dim myPnlCLV As B4XView
myPnlCLV = xui.CreatePanel("myPnlCLV")
myPnlCLV .Tag = "pnlSplashCLV"
myPnlCLV.LoadLayout("layCLV")
FillCLV
Dim mydblTop As Double
mydblTop = GetTopToCenterViewInAnotherView(CustomListView1.AsView, pnlParent)
myPnlCLV.Top = mydblTop
myPnl.AddView(myPnlCLV, 0, mydblTop, myPnl.Width, myPnl.Height)
Else ' Else myynDoppioPnl is false then add the CLV directly to pnlSplash
myPnl.LoadLayout("layCLV")
FillCLV
Dim myCLV As CustomListView = CustomListView1
Dim mydblTop As Double
mydblTop = GetTopToCenterViewInAnotherView(myCLV.AsView, pnlParent)
myCLV.AsView.SetLayoutAnimated(35, myCLV.AsView.Left, mydblTop, myCLV.AsView.Width, myCLV.AsView.Height)
' 30-35 is the minimum value to make moving CustomListView1, otherwise appears with Top value 0
End If
End Sub
Qualcuno ha qualche idea?
Grazie!