Android - Convert DP to Pixels Convert 32dp to pixels Resources r = getResources(); float pixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, r.getDisplayMetrics());