Is it possible to manually pre-compile a layout file, put it in a jar and use it? if possible how ?
I'll explain: When using a apk packaging, the build process pre compile xml resources, for runtime optimization. Let's say, for example, I want to load xml files from a server, and load them to ui. I need to pre-compile them, and I prefer doing it on server side with the android sdk.
XML tags define the data and used to store and organize data. It's easily scalable and simple to develop. In Android, the XML is used to implement UI-related data, and it's a lightweight markup language that doesn't make layout heavy. XML only contains tags, while implementing they need to be just invoked.
Specifically, Android considers XML-based layouts to be resources, and as such, layout files are stored in the reslayout directory inside your Android project. Each XML file contains a tree of elements specifying a layout of widgets and containers that make up one View.
Using Android's XML vocabulary, you can quickly design UI layouts and the screen elements they contain, in the same way you create web pages in HTML — with a series of nested elements. Each layout file must contain exactly one root element, which must be a View or ViewGroup object.
You can not provide more than one layout to any activity, but if you want to use the different layout files in one activity than you can include all layout files into a single layout file using tag and use them in you activity.
try this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With