When you encounter a situation like this, you can only tell your artists (we can’t call them designers here): This can’t be done!!!
Every time you design an App UI, it must be designed at a mainstream standard resolution. Then you can find the corresponding screen density, and finally you can convert px to dpi. If you deviate from this principle, it is a rogue, and in the end you will If the implementation is unrealistic and far from the UI design draft, that is none of your business.
Reference: Device Metrics
Calculation method: After knowing the resolution of the design draft and the screen density that the resolution generally corresponds to, calculate it according to the following formula:
dpi = px / density
p.s. Density is the value of the Density column in Device Metrics p.p.s. Don’t get into a passionate fight with your artist after reading this hot-blooded reply. If you have something to say, you should talk it over [face covering] [ Give in] 2333
First of all, you need to know what the screen size is in the design drawing It is usually 1080x1980 (? or other), usually belongs to xxhdpi, that is, 1dp is equivalent to 3px If the screen width of the design drawing is only 480 (or so), then 1dp should be It’s just 1px
1dp is defined as 1px when the screen density value is 160ppi, that is, at mdpi, 1dp = 1px. Taking mdpi as the standard, the density value ratio of these screens is: ldpi: mdpi: hdpi: xhdpi: xxhdpi = 0.75: 1: 1.5: 2: 3; that is, at the density of xhdpi, 1dp=2px; in the case of hdpi, 1dp=1.5px. Other analogies.
When you encounter a situation like this, you can only tell your artists (we can’t call them designers here): This can’t be done!!!
Every time you design an App UI, it must be designed at a mainstream standard resolution. Then you can find the corresponding screen density, and finally you can convert px to dpi.
If you deviate from this principle, it is a rogue, and in the end you will If the implementation is unrealistic and far from the UI design draft, that is none of your business.
Reference:
Device Metrics
Calculation method:
After knowing the resolution of the design draft and the screen density that the resolution generally corresponds to, calculate it according to the following formula:
p.s. Density is the value of the Density column in Device Metrics
p.p.s. Don’t get into a passionate fight with your artist after reading this hot-blooded reply. If you have something to say, you should talk it over [face covering] [ Give in] 2333
First of all, you need to know what the screen size is in the design drawing
It is usually 1080x1980 (? or other), usually belongs to xxhdpi, that is, 1dp is equivalent to 3px
If the screen width of the design drawing is only 480 (or so), then 1dp should be It’s just 1px
1dp=(screen ppi/160)px
Original link
public static float px2dp(Context context, float pxVal)
Conversion method: px ---> dp