开发者

Hide All Controls in a layout

开发者 https://www.devze.com 2023-02-04 16:34 出处:网络
I have a layout with at least 40 controls, including TextView, Spinners .. etc. .. I need some function to hide all controls.

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.


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)
}


You can Hide the parent layout of all this control

0

精彩评论

暂无评论...
验证码 换一张
取 消