Skip to content

Instantly share code, notes, and snippets.

@burntcookie90
Created May 4, 2014 04:15
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 burntcookie90/6e793e0c5a7d3ba65735 to your computer and use it in GitHub Desktop.
Save burntcookie90/6e793e0c5a7d3ba65735 to your computer and use it in GitHub Desktop.
get size in dp
float scale = getResources().getDisplayMetrics().density;
int dpAsPixels = (int) (sizeInDp*scale + 0.5f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment