Quantcast
Channel: WinDev Forum
Viewing all articles
Browse latest Browse all 1914

Android DPI fun (4 replies)

$
0
0
Hi all

Been beating my head against a wall all day today but finally worked out how to handle getting the DPI of any android device.... To help anyone else who may suffer in the same way, here's how..

Identify a static control on your window (IMG_Menu in my case)

Since in the WM editor everything is always based on 160DPI you can use the CoordinateScreenToEditor command to work out what the DPI is.

all variables have 2 decimal places..
nX = CoordinateScreenToEditor(IMG_Menu..X)
gnDPIRatio = Round(IMG_Menu..X / nX,2)

MyDPI = 160 * gnDPIRatio

Boom!

Viewing all articles
Browse latest Browse all 1914

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>