set Color Alpha between 0 ands 1 - Android Graphics

Android examples for Graphics:Color Alpha

Description

set Color Alpha between 0 ands 1

Demo Code


//package com.java2s;

public class Main {
    public static int setAlpha0to1(int color, float alpha) {
        return color & 0x00FFFFFF | Math.round(0xFF * alpha) << 24;
    }//from   ww  w  .j a v a  2  s.  c om
}

Related Tutorials