In Photoshop file font size is 20px. What sp will be for this in Android? Is it the same, that is, 20px = 20sp or something else?
Developer is asking for sp not px. How can I know or define sp in Photoshop?
You would use
sp
for font sizes dip
for everything else.
dip==dp
From Android Developers center:
px
Pixels - corresponds to actual pixels on the screen.in
Inches - based on the physical size of the screen.
1 Inch = 2.54 centimetersmm
Millimeters - based on the physical size of the screen.pt
Points - 1/72 of an inch based on the physical size of the screen.dp
Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".sp
Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.
You can use this to convert various options to convert between pixels sizes
At mdpi resolutions, 1dp = 1px.
At hdpi resolutions, 1dp = 1,5px.
At xhdpi resolutions, 1dp = 2px.
At xxhdpi resolutions, 1dp = 3px.
At xxxhdpi resolutions, 1dp = 4px.
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