Skip to content

Instantly share code, notes, and snippets.

@jfsurban
Created April 22, 2013 12:01
Show Gist options
  • Save jfsurban/5434434 to your computer and use it in GitHub Desktop.
Save jfsurban/5434434 to your computer and use it in GitHub Desktop.
convert dip to pixels (http://stackoverflow.com/a/8399445)
int dipValue = 200; // we whant to convert this dip value to pix
Resources r = getResources();
float pix = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, r.getDisplayMetrics());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment