I am developing an app, in which when user clicks on button a view will display a view below that, view height depend upon some criteria.It will be some x height or y height, no other height.Now my question is, what is the correct way of assigning height to that view, should I hard code it depend upon criteria or every-time I should calculate height based on the inside view placed.If I calculate height every-time then for now it is useless because we know what should be the height but in future it may happen that the UI changes, so the height may be changed.
I want to know what you guys think, which the correct way?
Thanks in advance!
I would use hardcoded values as long as the views layout does not change. Even if if will change later I would first use the hardcoded values and then when it is really needed I would change the implementation to a dynamic one. The reason behind my logic is that until it is really needed conditions can change very quickly and therefore even if you implement the a dynamic implementation now you can not be sure that you do not need to change it again when it is really needed because of a specification change until then e.g.