cachapa / ExpandableLayout

An expandable layout container for Android
Apache License 2.0
2.34k stars 273 forks source link

remove setVisibility #60

Closed u-nation closed 6 years ago

u-nation commented 6 years ago

Hi, Thanks for the great library.

I think setVisibility is redundant.

In the case where setVisibility(GONE) is called, the height or width has already become 0 and it is already invisible.

And It is not preferable to call it every time in terms of performance.

Best,

cachapa commented 6 years ago

By setting visibility to GONE we're removing the view from the layout hierarchy which means it doesn't participate anymore in layout passes. This has a much greater benefit to performance than the cost of the setVisibilty call, moreso in cases of complex child layouts or when there are multiple ExpandableLayouts on screen, e.g. in a recycler view.