get Color from base color and alpha percent - Android Graphics

Android examples for Graphics:Color Alpha

Description

get Color from base color and alpha percent

Demo Code


//package com.java2s;
import android.graphics.Color;

public class Main {
    public static int getColor(int baseColor, float alphaPercent) {
        return (baseColor & 0x00FFFFFF)
                | (Math.round(Color.alpha(baseColor) * alphaPercent) << 24);
    }//from   w  w  w. j a  v  a2 s.  c om
}

Related Tutorials