在 Android 中有一个 XML 文件的真正目的是什么?

What's is the real purpose of having an XML file in Android?

伙计们。我正在开始 Android 开发,所有的辅导视频都不断提到 XML 文件。我查了一下 XML 的意思,上面写着:"XML was designed to describe data." 但是为什么 Android 和一般情况下需要 XML(请用简单易懂的词解释)?有什么方法可以创建项目 w/o XML 文件吗?提前致谢!

根据Android documentation

The advantage to declaring your UI in XML is that it enables you to better separate the presentation of your application from the code that controls its behavior. Your UI descriptions are external to your application code, which means that you can modify or adapt it without having to modify your source code and recompile. For example, you can create XML layouts for different screen orientations, different device screen sizes, and different languages. Additionally, declaring the layout in XML makes it easier to visualize the structure of your UI, so it's easier to debug problems.

Using Android's XML vocabulary, you can quickly design UI layouts and the screen elements they contain, in the same way you create web pages in HTML — with a series of nested elements.

简答。让您的生活更轻松。