Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

most lightweight ViewGroup for containers

what is the ViewGroup you should use when needing a container e.g. for a fragmenttransaction? I am kind of between FrameLayout and LinearLayout from my feeling but I would like to make a decision on facts ;-)

like image 692
ligi Avatar asked Oct 14 '14 23:10

ligi


People also ask

Why do you extend ViewGroup?

You can implement your custom layout manager by extending the ViewGroup class. This allows you to implement more efficient layout managers or to implement effects which are currently missing in the Android platform.

What are ViewGroups and how they are different from the views?

View is a simple rectangle box that responds to the user's actions. ViewGroup is a collection of Views(TextView, EditText, ListView, etc..), somewhat like a container. A View object is a component of the user interface (UI) like a button or a text box, and it's also called a widget.

Which layout is faster in Android?

Measurement results: ConstraintLayout is faster As these results show, ConstraintLayout is likely to be more performant than traditional layouts. Moreover, ConstraintLayout has other features that help you build complex and performant layouts, as discussed in the benefits of a ConstraintLayout object section.

Which layout is best in Android Studio?

LinearLayout is perfect for displaying views in a single row or column. You can add layout_weights to the child views if you need to specify the space distribution. Use a RelativeLayout, or even better a ConstraintLayout, if you need to position views in relation to siblings views or parent views.


1 Answers

The android project template uses FrameLayout for fragment transactions, so I'd go with the FrameLayout

like image 63
kmdupr33 Avatar answered Sep 27 '22 22:09

kmdupr33