CardView - layout_height="wrap_content" or const value - performance impact?

262 views Asked by At

I have RecyclerView with CardViews. Do my list work slower if I set layout_height="wrap_content" rather then layout_height="const_value_dp" in CardView?

2

There are 2 answers

1
gautam On

No there should not be any performance impact of wrap_content over constant_value_dp its only the programmers choice.

0
Exigente05 On

One thing is for sure, if you use layout_height="0dp" or layout_width="0dp" with weightSum in its parent layout then it causes bad performance.

Layout weights require a widget to be measured twice. When a LinearLayout with non-zero weights is nested inside another LinearLayout with non-zero weights, then the number of measurements increase exponentially.