Doubt with correct dpi (dp) density

1

I'm a beginner in Android app development, and I have a simple question.

The dpi numbers in the image below are also the maximum that an img can have in width & height (dp) in their respective densities ... Right?

If this is it, then I can decrease this dp any way I want, just can not go over?

    
asked by anonymous 07.11.2018 / 01:33

1 answer

4

No. Screen density (dpi) does not limit the maximum value to use in width & height (dp).

A screen has two characteristics:

  • Screen Size - Represents the actual diagonal measurement of the screen, expressed in inches.

  • Screen Resolution - The number of pixels the screen contains.

The density of the screen is the result of these characteristics. Its value is the ratio of a given number of pixels to the size occupied by them on the screen, expressed in dpi (dots per inch).

Another thing is the unit dp used in width and height.

dp is a "virtual" unit that allows dimension values to be interpreted to occupy the same physical space, whatever the density of the screen. 1dp is equivalent to a physical pixel on a 160 dpi screen. 160 dpi is the density of a medium density screen (mdpi). When expressing the dimensions in dp the system will draw views in order to have the same real / physical dimension regardless of screen density.

As a complement, see Supporting Multiple Screens / Screens .

    
07.11.2018 / 10:52