I have the following problem:
I have a list view, I want to assign a gradient color to item separator ( Divider) of this list view. I am using the following code:
list = (ListView) findViewById(R.id.list);
int[] colors = { 0, 0xffffff00, 0 };
list.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
list.setDividerHeight(4);
I looked up the color code (0xffffff00) from: http://developer.android.com/reference/android/graphics/Color.html
PROBLEM:
However this color is Yellow, what I want is golden. I am also interested to know how this works, I mean how can I define the color of my choice, so far I tried to understand from the developer site but it is not much clear.
that you wrote is the hex notation. You can think about a color as composed of 4 components. ARGB. In your example you have 0xffffff00. The first ff is the alpha component, the second ff is the red component, the third ff is green component the fourth 00 is the blue component. Change those hexadecimal values you can get your colors.
Use
int color = Color.argb(255, 255, 175, 64);
or use an iteger to hex converter
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments