Last active
April 18, 2016 02:54
-
-
Save shau-lok/0ffce303b47b264ccdf80e6da150a5cd to your computer and use it in GitHub Desktop.
像素转换,using density
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int width = 72; | |
int height = 96; | |
float scale = getResources().getDisplayMetrics().density; | |
int pixelsWidth = (int) (width * scale + 0.5f); | |
int pixelsHeight = (int) (height * scale + 0.5f); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment