Dynamic layout changes than static layouts

Can someone briefly explain the advantages and disadvantages of dynamically changing layouts rather than static layouts? I came across this question in a quiz. Please explain your answer in detail. The following are rights / false issues.

  • Dynamically created layouts will appear on the screen and will respond noticeably faster than static layouts.

  • Dynamically created user interfaces can adapt to the execution state of applications, for example, to the amount of data that must be displayed at any given time.

  • Dynamic layouts can use contextual information that is not monitored by the Android configuration system (for example, current location, time of use, or ambient light measurements).

  • Static layouts cannot use contextual information such as device orientation.

+6
source share
1 answer

The first operator is False, because the idea of โ€‹โ€‹allowing static and dynamic layouts is not to increase efficiency, but to better separate the view from the model / controller and allow layout changes without recompiling the code. See here for more info: Android xml vs java layouts .

The second and third operators are True, because this is information that can only be determined at run time, so in order to take advantage, you will need to create some dynamic linking parameters, for example. updating the position on the map or updating the current weather for the area in which you are located.

The bottom statement is False because you can have layouts in XML files that are called specifically for device orientation, for example. layout land.xml. Android will choose this layout correctly when the configuration is changed to landscape.

Remember that Android allows you to use both static and dynamic layouts, but from what I read, most people choose static layout options where possible, since this separation greatly facilitates making changes to the layout. Dynamic XML format in Android?

Good luck with this course, I believe that I am doing the same.

Greetings

Alexey Blue.

+11
source

All Articles