Skip to content

Instantly share code, notes, and snippets.

@MaartenS
Last active March 30, 2016 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaartenS/1804d3a6e3f6a9717a1eb1e15e7ea54a to your computer and use it in GitHub Desktop.
Save MaartenS/1804d3a6e3f6a9717a1eb1e15e7ea54a to your computer and use it in GitHub Desktop.
float scale = getResources().getDisplayMetrics().density;
dpAsPixels = (int) (sizeInDp * scale + 0.5f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment