Android examples for Graphics:Color Value
get Color Between two color values
//package com.java2s; import android.graphics.Color; public class Main { public static int getColorBetween(int initialColor, int finalColor, float percentage) { int temp = 0; temp |= Math.round(Color.alpha(initialColor) + (Color.alpha(finalColor) - Color.alpha(initialColor)) * percentage) << 24; temp |= Math.round(Color.red(initialColor) + (Color.red(finalColor) - Color.red(initialColor)) * percentage) << 16; temp |= Math.round(Color.green(initialColor) + (Color.green(finalColor) - Color.green(initialColor)) * percentage) << 8; temp |= Math.round(Color.blue(initialColor) + (Color.blue(finalColor) - Color.blue(initialColor)) * percentage);//w w w . j a v a 2 s.c o m return temp; } }