I am trying to drawing a rectangle view in my application, but its looks different in different devices having different screen resolution. Any idea how to draw same size of view in all different resolution devises. Thanks in advance.
Asked
Active
Viewed 4,457 times
1 Answers
9
From the documentation (Supporting multiple Screen Sizes):
Multiply your dimensions with scale
// Get the screen's density scale
final float scale = getResources().getDisplayMetrics().density;

Sherif elKhatib
- 45,786
- 16
- 89
- 106
-
Thanks for your response Sherif elKhatib, can you give a example – VKJ May 16 '12 at 09:01
-
1check the answer of prasobh on this question :http://stackoverflow.com/questions/4605527/converting-pixels-to-dp-in-android – Sherif elKhatib May 16 '12 at 09:49