0

I have a custom view.

When I draw a line from (x,y) to (x+10,y), is the distance in DIP or PX?

3 Answers3

0

As documentation says,

At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use.

Thus, all units are in dp.

Alexander Zhak
  • 9,140
  • 4
  • 46
  • 72
0

If you are using one of the Canvas.drawLine methods it is in PX

Sound Conception
  • 5,263
  • 5
  • 30
  • 47
0

I believe it's in pixels. If you want to know how to convert from DP to pixels as in if you want your custom view to work with DPs just like all other Views.

Converting pixels to dp

Community
  • 1
  • 1
chubbsondubs
  • 37,646
  • 24
  • 106
  • 138