Answer the question
In order to leave comments, you need to log in
How to specify coordinate values in Canvas.drawLine() method in pixels?
Here is the situation. I have a device whose screen width is 540 pixels (as DisplayMetrics.widthPixels gives). I'm trying to draw a line with a length of 250. And it is drawn on about 1/5 of the screen, although it should be half. It turns out that the line coordinates are not set in screen pixels, but in some completely different ones. Actually, what is the question?
Simply, I need to draw a line of a certain length in pixels, and by experience (above), I determined that when calling Canvas.drawLine(X, Y, X2, Y2) we pass non-pixel values there. But I need it in pixels.
What should I do?
PS Google, did not find.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question