Show a hidden view. - Android User Interface

Android examples for User Interface:View Hide Show

Description

Show a hidden view.

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    /**// w w  w .  ja v  a2  s  . c om
     * Show a hidden view.
     *
     * @param v
     */
    public static void show(View v) {
        if (v.getVisibility() == View.GONE)
            v.setVisibility(View.VISIBLE);
    }

    /**
     * Show or hide a view.
     *
     * @param v
     * @param shouldShow
     */
    public static void show(View v, boolean shouldShow) {
        if (shouldShow)
            show(v);
        else
            hide(v);
    }

    /**
     * Hide a view.
     *
     * @param v
     */
    public static void hide(View v) {
        if (v.getVisibility() == View.VISIBLE)
            v.setVisibility(View.GONE);
    }
}

Related Tutorials