get Color With Alpha - Android Graphics

Android examples for Graphics:Color Alpha

Description

get Color With Alpha

Demo Code


//package com.java2s;

public class Main {
    public static int getColorWithAlpha(float alpha, int baseColor) {
        int a = Math.min(255, Math.max(0, (int) (alpha * 255))) << 24;
        int rgb = 0x00ffffff & baseColor;
        return a + rgb;
    }//  ww w.j a  v  a  2  s.  co m
}

Related Tutorials