Home » Android » android – Single LinearLayout vs Single ConstraintLayout

android – Single LinearLayout vs Single ConstraintLayout

Posted by: admin June 15, 2020 Leave a comment

Questions:

If I have just a single LinearLayout with a few items in it, then what effects will be of replacing it with ConstraintLayout

<LinearLayout>
   <TextView>
   <TextView>
   <TextView>
</LinearLayout>

vs

<ConstraintLayout>
   <TextView>
   <TextView>
   <TextView>
</ConstraintLayout>

Are there any differences in their efficiencies?

How to&Answers:

For such a simple layout with no nesting and only 3 children TextView, LinearLayout is the best on conceptual complexity, on performance, on drag and drop user interface of Android Studio, on XML lines, on kB size of the app. Maybe I forgot something, but I would not dare to waste time and mess things with any other layout than the LinearLayout in this case.