I can’t understand why I can specify resources depending on dpi, screen size, orientation, etc, but not on resolution.
For example, I download thumbnails for articles from the web; they are always 300px wide. If the screen is at least 600px wide, I’d like to show them to the left of the text, and if the screen is less than 600px wide, I’d like to draw them above the text.
How can I rely on physical size units like dp/in/mm, if I don’t know the physical size of the screen itself?
Why doesn’t Android allow me to do this? What is the preferred way to handle such situations?
Because that’s generally not a good idea.
At the resource set level, you know physical size via
-small,-normal,-large, and-xlarge. So, for example, you could draw your icon on the left for-largeand-xlargeand draw your icon on top for-smalland-normal.The preferred way is to base design variants based on screen size and density.
That being said, you are welcome to do whatever you want via your own Java code. Layout resources and resource sets are a recommended convenience, nothing more.