B4X:
Private Sub GetAbsViewTop(xView As B4XView) As Int
Dim Top As Int = xView.top
Dim Parent As B4XView = xView.Parent
Do While Parent.IsInitialized = True
If GetType(Parent).EndsWith("b4a.BALayout") Then
Try
Top = Top + Parent.Top
Parent = Parent.Parent
Catch
Exit
Log(LastException)
End Try
Else
Exit
End If
Loop
Return Top
End Sub
Tested very little. Also, maybe someone has already published a snippet like this.
EDIT: read post #12
Last edited: