seba123neo
seba123neo

Reputation: 4748

Hide All Controls in a layout

I have a layout with at least 40 controls, including TextView, Spinners .. etc. ..

I need some function to hide all controls.

can be iterated with a control loop in a given layout? Set the visibility to an invisible?

for example something like:

For Each ctl AS Control in Layout
      ctl.Setvisibility(View.INVISIBLE)
Next

Thanks in advance.

Upvotes: 0

Views: 1606

Answers (2)

Henry Pootle
Henry Pootle

Reputation: 1216

It will be better to hide parent, but if you prefer you can hide only childs

for(int index=0,length=ctrl.getChildCount();index<length;++index)
{
   View view = ctrl.getChildAt(index);
   view.setVisibility(View.GONE)
}

Upvotes: 4

Anand
Anand

Reputation: 1325

You can Hide the parent layout of all this control

Upvotes: 0

Related Questions