Xml-driven Guis And Performance
Solution 1:
If you have a gander at the class documentation for LayoutInflater, you'll notice they say:
For performance reasons, view inflation relies heavily on pre-processing of XML files that is done at build time. Therefore, it is not currently possible to use
LayoutInflater
with anXmlPullParser
over a plain XML file at runtime; it only works with anXmlPullParser
returned from a compiled resource (R.something file
.)
So yes, layout files are indeed precompiled to some degree, and, judging by the above excerpt, it would be in the The precompiled layout file is located in your compiled APK package, as R$layout.class
output file (but I'm not 100% sure on that)./res/layout/<layout_id>.xml
. You'll notice if you extract it and open it in a text editor that most plain-text XML elements have been mapped to some binary form.
It would probably be the same kind of compression you can see in AndroidManifest.xml
files that get packaged into the APKs.
Post a Comment for "Xml-driven Guis And Performance"