Hide views - Android User Interface

Android examples for User Interface:View Hide Show

Description

Hide views

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    /**//from w w w.ja  v a  2  s. co m
     * Hide views
     * @param views Views to hide
     */
    public static void hideViews(View... views) {
        for (View v : views) {
            toggleViewVisible(v, false, View.INVISIBLE);
        }
    }

    /**
     * Toggle the visibility
     * @param v View
     * @param isVisible true if is visible
     * @param visibility Type of visibility
     */
    private static void toggleViewVisible(View v, boolean isVisible,
            int visibility) {
        v.setVisibility(isVisible ? View.VISIBLE : visibility);
    }
}

Related Tutorials