Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int dpToPx(float dp, Context context) {
- return dpToPx(dp, context.getResources());
- }
- public static int dpToPx(float dp, Resources resources) {
- float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics());
- return (int) px;
- }
Add Comment
Please, Sign In to add comment