I have read documentation, extract data from other sources as well, but unable to understand this very basic thing.
In android we use DP
, because its responsive and it stretches resources
with respect to the screen sizes.
My question is there are different densities of different screens. Lets consider following 2 screen densities.
- mdpi- 160dpi
- hdpi-240 dpi
Let say i define width-height
of an image as 20dpX20dp
People say don't use px
, because it varies from device to device, but dpi
also varying from device to device,
I know it works fine, but i want to understand the science behind this, how does it manages, when there are different dpi's
of different screen.
According to my understanding, 1dpi of screen won't be equal to 1dpi
of other screen.
Kindly guide me. I have just give up on this.