Android examples for Graphics:Color
generate Back Color With Tint Color
//package com.java2s; import android.content.res.ColorStateList; public class Main { private static final int ENABLE_ATTR = android.R.attr.state_enabled; private static final int CHECKED_ATTR = android.R.attr.state_checked; private static final int PRESSED_ATTR = android.R.attr.state_pressed; public static ColorStateList generateBackColorWithTintColor( final int tintColor) { int[][] states = new int[][] { { -ENABLE_ATTR, CHECKED_ATTR }, { -ENABLE_ATTR }, { CHECKED_ATTR, PRESSED_ATTR }, { -CHECKED_ATTR, PRESSED_ATTR }, { CHECKED_ATTR }, { -CHECKED_ATTR } };/*from w ww . j a va 2 s.c om*/ int[] colors = new int[] { tintColor - 0xE1000000, 0x10000000, tintColor - 0xD0000000, 0x20000000, tintColor - 0xD0000000, 0x20000000 }; return new ColorStateList(states, colors); } }