Android View Visibility Change switchVisible(ViewGroup viewGroup, int id)

Here you can find the source of switchVisible(ViewGroup viewGroup, int id)

Description

switch Visible

Declaration

public static void switchVisible(ViewGroup viewGroup, int id) 

Method Source Code

//package com.java2s;
import android.view.View;

import android.view.ViewGroup;

public class Main {
    public static void switchVisible(ViewGroup viewGroup, int id) {
        for (int i = 0; i < viewGroup.getChildCount(); i++) {
            View view = viewGroup.getChildAt(i);
            if (view.getId() == id) {
                view.setVisibility(View.VISIBLE);
            } else {
                view.setVisibility(View.GONE);
            }/*from  w w  w.  j  a  v a  2 s  .co m*/
        }
    }

    public static void switchVisible(ViewGroup viewGroup, View _view) {
        for (int i = 0; i < viewGroup.getChildCount(); i++) {
            View view = viewGroup.getChildAt(i);
            if (_view == view) {
                view.setVisibility(View.VISIBLE);
            } else {
                view.setVisibility(View.GONE);
            }
        }
    }
}

Related

  1. switchVisible(ViewGroup viewGroup, View _view)