Sub GetRelativeTop(V As JavaObject) As Int
Private offset=0 As Int
If GetType(V) = "android.view.ViewRoot" Or GetType(V) = "android.view.ViewRootImpl" Then
Return 0
Else
If V.RunMethod("getParent",Null) Is ScrollView Then
Private s As ScrollView = V.RunMethod("getParent",Null)
offset = s.ScrollPosition
LogColor(offset,Colors.Yellow)
End If
Try
Dim VW As View = V
Return VW.Top + GetRelativeTop(V.RunMethod("getParent",Null)) - offset
Catch
Return GetRelativeTop(V.RunMethod("getParent",Null)) - offset
End Try
End If
End Sub