Copernic Copernic - 1 month ago 6
Android Question

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.

Answer

are the layouts inflated

Yes.

and rendered

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

Comments