Android Question x,y float to percentage %

Douglas Farias

Licensed User
Longtime User
Hi all.
How can i convert x and y as float to percentage?

i have this panel
Sub pFundo_Touch (Action As Int, X As Float, Y As Float)
End Sub

i get this numbers when i log the (x)

how can i convert this number to %x or the y to %y?
all devices log diferent number on x and y, i think this is based on DIP.

thank you


Licensed User
You sure you need to convert it to % of screen? It feels like you're about to use the coordinates to plot stuff on the screen, in which case you might be better off leaving them as pixels, rather than converting back and forth.

Plus, pixels unlikely to be square in % units (although physical pixels might not be quite square either, but nowadays they're usually pretty close).
Upvote 0