开发者

draw a rectangle using rect method from android graphics but i want the rectangle to fit any screen

开发者 https://www.devze.com 2023-02-11 09:27 出处:网络
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 coordinat

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消