Can you hide an element in a layout, such as a spinner, depending on an activity?

SickNick picture SickNick · Dec 18, 2010 · Viewed 26.5k times · Source

I am working on my app which has 3 spinners in one view. Some of my activities will need to use 3 spinners, some 2, some 1, so I would like to hide them depending on the activity, if that is even possible. I am trying to do it like this so I can be as efficient as possible, but I have no idea if it is even possible.

Answer

CommonsWare picture CommonsWare · Dec 18, 2010

Call setVisibility(View.INVISIBLE) or setVisibility(View.GONE) on the Spinners as needed to hide them. GONE means totally gone; INVISIBLE means they still take up space but no pixels are drawn.