Android examples for Graphics:Color Alpha
Color to Alpha
//package com.java2s; import android.graphics.Color; public class Main { public static int toAlpha(int color, int alpha) { int r = getRed(color); int g = getGreen(color); int b = getBlue(color); return Color.argb(alpha, r, g, b); }//w w w . j a v a 2 s. c om public static int getRed(int color) { int red = (color & 0xff0000) >> 16; return red; } public static int getGreen(int color) { int green = (color & 0x00ff00) >> 8; return green; } public static int getBlue(int color) { int blue = (color & 0x0000ff); return blue; } }