Reputation: 51
i want to draw a rectangle using rect method form android graphics but i want to specify the values in dp so that it can fix to any screen size. i presume by default its in pixel or just x,y coordinates. how can i draw it to fit in any screen size using the rect method
Upvotes: 0
Views: 877
Reputation: 957
You can use DisplayMetrics to obtain the screen's size and pixel density and then calculate your rectangle's width and height accordingly by adjusting the width and height in relation to the screen's characteristics.
Upvotes: 1