Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Color; public class Main { /** * @param alpha 0...255 */ public static int setColorAlpha(int color, float alpha) { return Color.argb(Math.min(Math.max((int) (alpha * 255.0f), 0), 255), Color.red(color), Color.green(color), Color.blue(color)); } }