开发者

How to create a layout file programmatically

开发者 https://www.devze.com 2022-12-26 04:55 出处:网络
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 s

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

精彩评论

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