hides a view depending on a boolean value - Android User Interface

Android examples for User Interface:View Hide Show

Description

hides a view depending on a boolean value

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    /**//from w  w w  .  j a va 2s . co m
     * hides a view depending on {@param hide}.
     *
     * <br>
     *
     * analog to {@link #showView(android.view.View, boolean)}
     *
     * <br>
     *
     * If you want the View to be {@link android.view.View#GONE} instead of {@link
     * android.view.View#INVISIBLE} use {@link #setVisiblity(android.view.View, boolean)}
     *
     * @param view the view to hide
     * @param hide true means {@link android.view.View#INVISIBLE}, false {@link
     *             android.view.View#VISIBLE}
     */
    public static void hideView(final View view, final boolean hide) {
        view.setVisibility(hide ? View.INVISIBLE : View.VISIBLE);
    }
}

Related Tutorials