Android examples for Graphics:Color Value
parse Color to float Array
//package com.java2s; import android.graphics.Color; public class Main { public static float[] parseColor2Array(String colorStr) { float[] colorArray = new float[3]; int color = parseColor(colorStr); colorArray[0] = (1.0f * Color.red(color)) / 255.0f; colorArray[1] = (1.0f * Color.green(color)) / 255.0f; colorArray[2] = (1.0f * Color.blue(color)) / 255.0f; return colorArray; }//from w w w .j ava 2s.com public static int parseColor(String colorStr) { int color = 0xff000000; try { color = Color.parseColor(colorStr); } catch (Exception e) { e.printStackTrace(); } return color; } }