Doubt with correct dpi(dp) density

Asked

Viewed 183 times

1

I am beginner in Android app development, and am with 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 so, then I can decrease this dp the way I want, just can not overcome?

inserir a descrição da imagem aqui

1 answer

4


No. The screen density(Screen Density)(dpi) does not limit the maximum value to be used in width & height(dp).

A screen has two features:

  • Screen size(Screen size) - Represents the actual measurement of the diagonal of the screen, is expressed in inches(inch).

  • Screen resolution(Screen Resolution) - Number of pixels the screen contains.

Screen density is a result of these characteristics.
Its value is the ratio between a certain number of pixels and the size occupied by them on the screen, is expressed in dpi(Dots per inch).

Another thing is unity dp used in width and height.

dp is a "virtual" unit that allows the values of the dimensions to be interpreted in such a way as 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 the views in order to have the same real/physical dimension, regardless of the screen density.

As a complement see How to support various types of screens/screens.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.