Android Question B4X Tooltip

fbritop

Active Member
Licensed User
Longtime User
Hi,

I´ve been searching the forum for a simple toot tip that can be attached to a view (label, etc). Usually, I have small status icon that I would like, when the user clicks (or long clicks), then the toot tip is generated.

But every search for tooltip leads me to the IDE tooltips on intelisense or to B4J mouse over function. IS there anything like what bootstrap tooptip does on html?

 

Alexander Stolte

Expert
Licensed User
Longtime User
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Upvote 0

fbritop

Active Member
Licensed User
Longtime User
Nice solution, but requires the absolute position. It would not work in a customlistview, as the position of the view if relative to the panel and not to the activity
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
you can try this code, i use this code on my ASPopupMenu. But where I wanted to use it, it didn't work that way, because the listview was in an extra container.
B4X:
Sub ViewScreenPosition (view As B4XView) As Int()
    
    Dim leftTop(2) As Int
    #IF B4A
    Dim JO As JavaObject = view
    JO.RunMethod("getLocationOnScreen", Array As Object(leftTop))
    #Else If B4I
    'https://www.b4x.com/android/forum/threads/absolute-position-of-view.56821/#content
    Dim parent As B4XView = view
    Do While GetType(parent) <> "B4IMainView"
        Dim no As NativeObject = parent
        leftTop(0) = leftTop(0) + parent.Left
        leftTop(1) = leftTop(1) + parent.Top
        parent = no.GetField("superview")
   Loop
    #Else
    Dim parent As B4XView = view
   Do While parent.IsInitialized
       leftTop(0) = leftTop(0) + parent.Left
       leftTop(1) = leftTop(1) + parent.Top
       parent = parent.Parent
   Loop
    #End If

    Return Array As Int(leftTop(0), leftTop(1))
End Sub
This code gets the top value from the view on the screen.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…