如何以编程方式创建一个布局文件 [英] How to create a layout file programmatically

查看:144
本文介绍了如何以编程方式创建一个布局文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,如果它是可以动态创建要显示给用户一个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.

这篇关于如何以编程方式创建一个布局文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆