I have a few questions:
What is the screen size?
What is the screen density?
What is a difference between screen size and screen density?
How I can support different densities and different screen sizes in Android?
I have already read the official documentation, but I was unable to understand the difference between screen size and screen density.
Density Classes:
Icon Sizes:
Screen Size Classes:
Screen Configuration:
Best Practices:
Use wrap_content, match_parent, or dp
units when specifying dimensions in an XML layout file. Except for defining text sizes: sp
(scaling depends on user setting)
Do not use hard coded pixel values in your application code.
Do not use AbsoluteLayout,use Relative Layout.
Supply alternative bitmap drawables for different screen densities.
Provide a launcher icon for xxhdpi, but no other icons.
screen size is about how many pixels you can show on screen.
Density is based on your device real size, if it's small and has a higher resolution, than the density is high cause you show more pixels in less physical space.
1.screen size concerns an absolute number of pixels. (check out wikipedia Image Resolution)
2.Density (aka Pixels per inch - PPI) concerns a relative number of pixels per inch. (check out the wikipedia Pixel Density)
To put it simple:
Simply put, screen size
refers to the size of the screen.This varies from device to device.screen density
refers to the amount of pixels in a screen.Both are not independent though as screen size affects screen density.
There are different terms and can't be used interchangeably
density = how many pixels appear within a constant area of the display, dots per inch = dpi or ppi(pixels per inch )
size = amount of physical space available for displaying an interface, screen's diagonal, inch
resolution = number of pixels available in the display, scale-independent pixel = sp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With