I would like ask if there's a way to download an android layout from the Internet into the "res/layout" folder.
I was thinking in getting the file using an HttpUrlConnection and a FileOutputStream, like discussed in here Android download binary file probl开发者_如何学Cems but I can't fgure out how to put it into the "res/layout" folder.
Thanks!
Unfortunately the layouts in your 'res' directory are compressed at build time and include baked-in resource IDs that match your pre-built R.java. So it wouldn't be possible to take a new layout file at runtime and inflate it in the same way.
However layouts can be built up programatically (new Button() and so on), so you could probably make an XML format and reader that was quite similar to the standard layout format.
精彩评论