如何以编程方式创建一个布局文件创建一个、布局、方式、文件

2023-09-06 06:32:44 作者:做好自己。

我想知道,如果它是可以动态创建要显示给用户一个XML布局文件。该想法是能够从中央服务器,这可能显示该动态,服务器驱动的GUI检索布局文件

I was wondering if it were possible to dynamically create an XML layout file to be displayed to the user. The idea would be to be able to retrieve a layout file from a central server, which could display this dynamic, server driven GUI.

推荐答案

您将有同程资源ID是一个问题,$ P $在构建时对烘焙。

You'll have a problem with the way resource IDs are pre-baked at build time.

由于GUI元素,可以在运行时被实例化,你也许可以用XML解析器和一点反思滚你自己吹气。

Since GUI elements can be instantiated at runtime, you could probably roll your own inflater with an XML parser and a bit of reflection.