I have a row in a list that I am trying to implement. I can use one RelativeLayout or one LinearLayout with weights. Is there a clear winner in performance for one RelativeLayout or one linearLayout with weights?
Save this answer. Show activity on this post. Unless you're laying out lots of Views (e.g. in a ListView), the performance of choosing between LinearLayout or RelativeLayout is negligible. Pick whichever is most convenient to use for the job, and worry about performance only when you need to.
RelativeLayout does not pay attention to android:layout_weight . (That's a property of LinearLayout.
LinearLayout : is a ViewGroup that aligns all children in a single direction, vertically or horizontally. RelativeLayout : is a ViewGroup that displays child views in relative positions.
relativelayout is deprecated now.
It actually depends on what you are trying to implement. If this is just a content of a row from ListView, I would prefer LinearLayout with weights. There are good answers from this question about using RelativeLayout or LinearLayout, which is related to your's:
Is a RelativeLayout more expensive than a LinearLayout?
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