开发者

How to create a layout file programmatically

I was wondering if it were possible to dynamically create an XML layout file to be display开发者_StackOverflow社区ed 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.


XML layout files are packaged as binary and the inflation occurs from binary as well. I don't believe that arbitrary XML can be used for layout.


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜