balsick
balsick

Reputation: 1201

Setting layout by remote xml

I was wondering if it was possible to set a view through a remote xml file. I had a look on the web and I found this post here on stackoverflow. Reading the answers I got I can't do it. Why?

Upvotes: 1

Views: 273

Answers (1)

Squonk
Squonk

Reputation: 48871

XML layout files are pre-processed at build time in order to provide efficient inflation of complex layouts.

Although there are LayoutInflator methods which take a path to an XML file, they have never been implemented.

In other words, unless your XML layout file is pre-processed and packaged at build time into your APK, then it can't be done.

There is one possibility, however, you could build an XML parser to parse your 'external' XML layout file and create your layout dynamically using Java code - not impossible but you're pretty much on your own if you choose to do that.

Upvotes: 3

Related Questions