问题
Hello guys and girls.
As i already asked, is someone here who can give me a hint how to calc the right ammount of dimens?
As far as i know:
- dimens "small" support devices with a <=3,4 inch screen
- dimens "normal" from 3,4 to 5,0
- dimens "large" from 4,5 to 7
- dimens "xlarge" from 7 to +
these are relative to the physical screensize in inches and NOT the correct numbers. Got it from a graph on this website without labeling: https://developer.android.com/guide/practices/screens_support.html
also there are dimens which depends on the ammount of pixels.
- ldpi
- mdpi
- hdpi
- xhdpi
Do i really need to have 16 different folders, to prevent that a wrong layout is shown on the device, like; small-ldpi,small-mdpi,small-hdpi,small-xhdpi,normal-ldpi,normal-mdpi,normal-hdpi and so on. If so, do i need to create 16 AVD´s to test each layout? Also, the emulator is not so accurate with displaying the layout as it is on a real device. So do i need to have 3 or 4 physikal devices with the most common screensizes and resolutions.
If i only consider the screensize in inch, is it still possible to have a consistent layout?
The resolution of the Icons: If i want to have the icon in a consistent relation to the layout, how much icons should i create? im thinking about 4 different sizes of each icon( ldpi,mdpi,hdpi and xhdpi) but every icon is in 4 different folders small/normal/large/xlarge.
Thank you for your help, Phil
Quote: Like my IT teacher said, a good programmer doesn´t need to know anything, he only needs to know where to find it. cheers
P.S, im asking cause i don´t like to spend hours and hours in xml if someone can say " listen, 5 folders are enough. 16 folders are 'nice to have' maybe a 6th because of this new 21:9 hype."
回答1:
i was also running with same issue then i used this awesome library a scalable size unit - SDP Intuite
No need to worry on different density device this library will handle it
thanks
来源:https://stackoverflow.com/questions/44630037/fill-the-dessert-in-my-head-with-dimens-xml