What is the benefit of having RelativeLayout after the introduction of ConstraintLayout?

Viewed 170

I totally understand the advantage of having ConstraintLayout when flatenning nested UI's. But with the introduction of ConstraintLayout I see people adopting it instead of RelativeLayout even for simple layouts with a flat structure.

  • Does ConstraintLayout always performs better than RelativeLayout? Specifically in the case when a view can be achieved with single flat structure with no nested UI?
  • If yes, shouldn't Relative Layout be deprecated?

Any help would be much appreciated :)

3 Answers

I think that should be a matter of choice and customs. Some UI designers prefer RelativeLayout where others prefer ConstraintLayout. The ConstraintLayout can be used in many cases more than the RelativeLayout. And yes it performs better than the RelativeLayout but I think for just a single flat structure I can opt for RelativeLayout too though due to support tooling provided by the ConstraintLayout it makes it a better option if you need that feature.

That's my point of view.

Yes, it performs better, ConstraintLayout has designed with performance optimization in mind. Also, it's very straightforward to use by just drag and drop things. I really like Constraint layout to develop complex layout faster than any other one, but in my opinion, it's harder to make changes on it when you need, but is just my point of view

Q1 - Does ConstraintLayout always performs better than RelativeLayout

A1 - I saw a lot of questions and answers on StackOverflow about that subject and here is what I can say base on those threads and my personal experience with ConstraintLayout :

  • In most cases, if you are using ConstraintLayout properly it will work faster but , there is no guaranty that this is what you will get all the time.

  • From my personal experience with ConstraintLayout, it is working really fast and in all of my layouts (both simple and complicated in terms of UI) it works faster than RelativeLayout.


Q2 - shouldn't Relative Layout be deprecated

A2 - Why I believe that Relative Layout should not be deprecated.

  • I honestly don't see any valid reason for RelativeLayout to be deprecated, altho I am using ConstaintLayout I first started with RelativeLayout and now I see it as another tool to build my UI.

  • If it's not broken don't fix it:

    • Don't forget that there are a lot of developers around the globe, some prefer RelativeLayout and some prefer ConstraintLayout, let's keep it this way is what I believe - don't take the option to choose from the developers, give them the option to choose what to use.
    • ConstraintLayout is not a better solution for building UI as a fact, its just my opinion.

      I really think that its something that depends on the developer and his decisions, therefore - no layout is better than the other and no layout should be deprecated (as long as it works)


Related