user1079425
user1079425

Reputation:

Are the "GONE" views inflated?

I have a huge XML layout, with many Relative / Linear layouts, and what I'm doing now is to hide all the layouts I don't need with setVisibility (View.GONE) and change their visibility when needed.

My question is : is this method sufficient? are the layouts inflated and rendered so they alter the phone memory and it's performances and time of the activity loading or they are not until I set the visibility to VISIBLE.

The layout is getting bigger so I would like to know if I should use Fragments or stay with what I have now.

Upvotes: 16

Views: 2334

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006614

are the layouts inflated

Yes.

and rendered

No. They are part of the view hierarchy but are ignored in the rendering passes.

Upvotes: 25

Related Questions