The file size for Photoshop is 20 pixels, what will be for this in Android? It is the same? does 20px = 20sp mean or something else?

The size of the Photoshop file is 20 pixels. What will happen for this in Android? Is it the same as 20px = 20sp or something else?

The developer asks for sp not px. How can I find out or define sp in Photoshop?

+6
source share
4 answers
  • px is one pixel.
  • sp - scale independent pixels.
  • dip - density independent pixels.

Would you use

  • sp for font size
  • dip for everything else.

    inclination == dp

From Android Developer Center :

points
Pixels - correspond to the actual pixels on the screen.

in
Inches - based on the physical size of the screen.
1 inch = 2.54 centimeters

mm
Millimeters - depending on the physical size of the screen.

Fri
Glasses - 1/72 inch, depending on the physical size of the screen.

dp
Densely-independent pixels are an abstract block based on the physical density of the screen. These units refer to a screen with a resolution of 160 dpi, so one pixel is one pixel on a screen with a resolution of 160 dpi. The dp-to-pixel ratio will vary with screen density, but not necessarily in direct proportion. Note. The compiler accepts both "dip" and "dp", although "dp" more closely matches "sp".

sp
Scalable pixels - this is similar to the dp block, but it also scales according to the user's font size preference. It is recommended to use this machine when setting font sizes, so they will be configured both for screen density and user preferences.

You can use this to convert various parameters to convert between pixel sizes

+5
source

In resolutions mdpi 1dp = 1px.

In resolutions hdpi 1dp = 1,5px.

In resolutions xhdpi 1dp = 2px.

In resolutions xxhdpi 1dp = 3px.

In resolutions xxxhdpi, 1dp = 4px.

+3
source

They are different, and you should use sp, not px. See This fooobar.com/questions/78 / ... post

sp

Scalable pixels - it looks like a dp block, but it also scales according to the user's font size preference. It is recommended to use this block when setting font sizes, so they will be adjusted for both screen density and user preferences.

This tool is convenient for converting px to sp or dp: http://pixplicity.com/dp-px-converter/

+1
source

Just use px in your photoshop.! Since you cannot compare px with sp since there are seven DPI options!

  • xxxhdpi
  • xxhdpi
  • xhdpi
  • HDI
  • Mdpi
  • Idpi
  • tvdpi

PX will be equal to DP in mdpi (160 dpi), but SP will not ...

  Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user 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 preference.

calculation of various values
http://angrytools.com/android/pixelcalc/

comparison of various DPI
http://coh.io/adpi/

0
source

Source: https://habr.com/ru/post/977640/


All Articles