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 t开发者_高级运维he rect method
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.
精彩评论