Is there a "best practice" or noticeable difference in performance between using Java to do layouts in Android over XML?
For the sake of it, assume we are just laying out a relatively simple UI which uses multiple activities.
Once you have a reasonable understanding of layout it's far, far easier and quicker to use XML.
Inflating layout XML is never going to be quite as fast as instantiating views manually, but the difference is likely to be very small (walking a binary XML tree is probably a cheap thing to do), and inflating should be way too infrequent an event to think about optimizing for.
An advantage of XML layouts are better is that they permit to define multiple layouts with smaller code
for multi-language application u can define French and english UI and load the desired one at application startup
they permit to support many screen resolutions and orientation (define main.xml file for each profile)
also u can easily add and modify layout without touching u'r code
so, better to USE IT
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