Create, Store And Inflate Custom Layout In Runtime
I'm trying to find a solution for the following problem. The application I work on requires a possibility for user to produce custom UI (layout of simple widgets) via custom UI bui
Solution 1:
Check out the inflate methods of LayoutInflater. You can actually give it any XmlPullParser
to use as its source, which in turn can be constructed given any Reader
.
In other words, you can use just about any character stream as your xml source for inflating.
The beginning of the XmlPullParser docs gives you the basic outline for creating the pull parser:
XmlPullParserFactoryfactory= XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParserxpp= factory.newPullParser();
xpp.setInput(newStringReader("<foo>Hello World!</foo>"));
Update - this isn't going to work, as mentioned in the LayoutInflater
docs.
Post a Comment for "Create, Store And Inflate Custom Layout In Runtime"