Imran Balouch
Imran Balouch

Reputation: 2170

Do hidden layouts impact performance or not?

I have a Relative layout which has a lot of Table layouts in it, because of which I am having the warning:

Layout has more than 80 views, bad for performance

Out of all my those table layouts, only one will be visible at a time, based on selection from spinner, my question is will it also hurt performance or its good to go with this approach?

Instead of putting them in separate layout files, I put them in single file because in that case I will end up with a hell lot of xml files.

In the xml file, only first table layout is visible, all others have:

android:visibility="gone"

Please advice...

Upvotes: 0

Views: 308

Answers (1)

Henrique
Henrique

Reputation: 5011

Yes, hidden layouts do impact performance cause even though they are not displayed, they are still part of the view hierarchy. Try looking into ViewStub to see if it's a valid replacement for your needs: See Documentation

Upvotes: 1

Related Questions