Difference between px,dp,sp,dip
They all make UI compatible for Android Devices
px: Its the standard pixel. We cas say actual pixel on the screen or one pixel.
px = dp * (dpi / 160)
dp: (Density Pixels). Its based on physical density of any screen.We can say simply for 160 dp screen, one dp is equal to one pixel.
Use dp except for font size.
dip: (Density Independent Pixels) dip is similar to dp. Earlier version, dip was used but now we use dp.
sp: (Scale Independent Pixels) : It is also like dp we use it when define font sizes. It also scaled by font preferences , So for Fonts we should use sp.
0 Comment(s)