DP/PX Converter
Calculate pixels (and other units) in DPs
This tool helps you convert pixels to and from DPs (density independent pixels).
1. Enter a value and unit to calculate the dimensions for the various DPI bins (ldpi, mdpi, hdpi, xhdpi, xxhdpi and xxxhdpi).
2. Enter either a DP (density independent pixel) value or a PX (pixel) value below. If you use pixels, you can set the screen density that it currently displays on.
The values are calculated based on:
- LDPI = 120 dpi
- MDPI = 160 dpi
- TVDPI = 213 dpi
- HDPI = 240 dpi
- XHDPI = 320 dpi
- XXHDPI = 480 dpi
- XXXHDPI = 640 dpi
Take special note of the nodpi
bin; specifying resources using this qualifier specifically instructs the system to not scale resources, regardless of the current screen's density. The DP/PX converter above behaves slightly different when selecting this bin, as it treats the specified pixel dimension as DP.
Source:
More reading:
- Android Developer Guide on Supporting Multiple Screens
- TalkAndroid.com on DPI categories
- Adapted from Android DP / PX converter by Skinkers