set View Alpha Zero - Android User Interface

Android examples for User Interface:View Alpha

Description

set View Alpha Zero

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    public static void setAlphaZero(View view) {
        if (view != null) {
            view.setAlpha(0);//from w  w w .  j a v a 2  s .  c  o  m
        }
    }

    public static void setAlpha(float percentageCanSee, View view) {
        if (percentageCanSee < 0) {
            percentageCanSee = 0;
        }
        if (percentageCanSee > 1) {
            percentageCanSee = 1;
        }
        view.setAlpha(percentageCanSee * 255);
    }
}

Related Tutorials