Why does Android use the xml Description Interface? androidxml description
XML can completely separate the content and structure of a program. It can completely separate content management from process management, reduce development coupling, and facilitate project management. In addition, XML has a unified standard syntax. All XML documents supported by any system and product have a unified format and syntax, which is conducive to cross-platform migration and high scalability. With Swing mode, the coupling is high, and the maintenance cost is higher than that of XML.Xml is a universal international standard (if you can create such a standard). Now, almost all computer languages use xml and will deal with it; the use can achieve the separation of the interface and code (reduce coupling and portability); swing is only part of the Java class library, if you use swing, it is better to use Java directly.
It is best to write the Android layout in the res/layout folder in xml format. This not only separates the foreground interface from the business logic, but also makes the code clearer,
More importantly, it facilitates model adaptation and internationalization of apps.
Putting these controls into an xml file is an important aspect for android to ensure the MVC Architecture. The layout is the View layer, which is isolated from the logic code,
So it's better to put it in an xml file? However, some dynamic controls cannot be put into java code!