I have a style guide of iOS app which specifies height, width, padding, font size etc in PT (1x as base). I have converted them successfully in pixels for various iPhones like iPhone 5,6,6s Plus, 7, iPad.
Now I need to use the same style guide for Android App, but I am clueless how should I convert iOS PT to android DP or pixel?
Is there any common method or something which can specify like: 30pt of 1x iOS converts into X dp (or pixel) of mdpi android?
I have searched but couldn't find hint for this. If someone could help me here, that would be great.
The DP is supposed to be equal to the PT in IOS. You should not need any translation at all. They are both a representation of the experienced resolution, and they hide the true resolution.
Definitions. px or dot is a pixel on the physical screen. dpi are pixels per inch on the physical screen and represent the density of the display. dip or dp are density-indenpendant pixels, i.e. they correspond to more or less pixels depending on the physical density.
If device-independent pixel (dp) is used as the unit of length, then the operating system of the device maps the dp value to a corresponding number of pixels based on the resolution of the device screen. For this mapping, 1 dp is considered to be equal to 1 pixel on a 160 dpi resolution screen.
dp to px converts following this formula: dp * scaler = px. A single pt is exactly 1/72 of an inch on any screen density. Android converts pt to px using the exact dpi (xdpi and ydpi) of the device's screen. pt to px converts following this formula: pt / 72 * dpi = px.
The DP is supposed to be equal to the PT in IOS. You should not need any translation at all. They are both a representation of the experienced resolution, and they hide the true resolution. By the way, you may have made a small mistake by using @2x as base for your design guide.
The difference is how android converts both units to pixels, which depends on the screen density of the device. A single dp is a single px on a device at 160 dpi. Android uses the "density bucket" the device falls into, and multiplies a scaler to convert dp to px.
The DP is supposed to be equal to the PT in IOS. You should not need any translation at all. They are both a representation of the experienced resolution, and they hide the true resolution.
By the way, you may have made a small mistake by using @2x as base for your design guide. When one works from a design guide one should not have to think about pixels, Only PT/DP. Only icons and images should be produced in different resolutions. The UI should be defined in PT/DP with 1x (The "official" resolution) as the base. For iPhone 4/4S that resolution would be 320x480 even though the actual resolution is 640x960. For Android it's not that simple because of the unrestricted sizes available for any vendor to produce. I would recommend using something like 1080p (DP) resolution for the design guide, but use a relative design, and be mindful of the components that will need to resize to accommodate any screen size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With