Search code examples
androidxmlandroid-layoutxml-parsingprogrammatically-created

Parse android xml layout and create views from it programmaticaly


I have the following problem: Download complex xml-layout with many views from the server while running the application, dynamically attach it to app and display the necessary elements with ability to work with them.

I learned that at the moment this is not possible, at least there are no simple ways to do this (https://stackoverflow.com/a/1942224/1956299). I am wondering is it possible to parse downloaded xml-layout for my self and create the necessary ui elements programmatically? Considering layout can have many different elements with child views etc.? If yes, how it would be better and easier to do this?


Solution

  • There is only solution to do this

    Read Xml By XmlPullParser line by line get the View Tag from incoming layout file,View attributes and create View Dynamically by java code