I'm a relatively new app programmer, largely self-taught over the last year.
From the beginning I naturally went down the path of sizing the UI using percentages in the xml files where possible. And where this wasn't possible I calculated screen metrics at runtime and calculated dimensions based on a percentage of these screen metrics. So each time I change the UI I only have to change one number.
This has worked quite well, giving consistency between the array of android devices. Although I recognize this could run into performance problems if there are a large number of objects that need sized at runtime.
Recently I've read more about using the multiple dimens.xml files to size the UI based on the 'size class' of the device. this seems the method most commonly used on android.
To me this method seems less efficient. You have to alter perhaps 3 or 4 dimen.xml files every time you change the UI. On top of that a dimen.xml file for large devices can cover a wide array of screen metrics, creating inconsistency between devices. The main gain seems to be better performance.
So my question is which method is better? Is the performance trade off worth the consistency, and time saved in making alterations to the UI? Or alternatively is there a better method that you could suggest?
No comments:
Post a Comment