Designing in XML or UI Coding. Which is Better?

I have little doubt. What is the best way to develop an interface for Android? Coding or Desinging in XML?

What is better in performance?

+4
source share
3 answers

From personal experience, I would say that the difference in performance between them is insignificant. However, use XML for a pure reason, to make it more convenient. Thus, you can create your own layouts in such a way that they can be easily recognized and edited by other potential developers (or even later).

Everything that you can do the layout in the code, you can do in XML, and if you need to add additional functions, you can still reference the elements in XML in the code using findViewById(R.id.ELEMENT_NAME);

+3
source

Performance will be similar (XML version will be slightly slower to load, but not noticeable). But using XML, you get automatic support for configuration changes at runtime. You can easily provide different layouts for different resolutions, orientations, languages, etc. It is recommended that you use XML to define your user interfaces as much as possible.

+3
source

First of all, I would say that this is a very good question, and I will say that it is XML that will be easier to use, and not code, for the following reasons:

  • Designing a layout using XML gives you the best look for your application;
  • If you want to create a seamless application, XML is the best way to do this;
  • It is much faster and faster to develop an interface with XML than with code.

That's what I think...

thanks
Rakesh

0
source

All Articles