How do int color codes in android work?

user2613996

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.

Blackbelt

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Android: Color codes

From Dev

Android: Color codes

From Dev

How do I display ANSI color codes in emacs for any mode?

From Dev

How the codes work for loading image from Gallery Android

From Dev

How the codes work for loading image from Gallery Android

From Dev

Hex Color codes maybe causing CSS to not work

From Dev

How to multiply hex color codes?

From Dev

How to convert UIColor to Android color (packed int)?

From Dev

How do I get color emoji to work

From Dev

How to do requests in Unity for android/IOS and get HTTP response codes

From Dev

What do the color codes mean for file blocks?

From Dev

Why do android.os.Build.VERSION_CODES work on older platforms

From Dev

Why do android.os.Build.VERSION_CODES work on older platforms

From Dev

How do android:shrinkColumns and android:stretchColumns work?

From Dev

How to produced group barplot with different color codes?

From Dev

How to get all color codes from LinearSegmentedColormap?

From Dev

How to recognize MICR codes in Android

From Dev

How to unpack JavaScript codes on Android?

From Dev

tput setaf color table? How to determine color codes?

From Dev

How to combine key codes to work together in javascript

From Dev

How does this recursive binary codes function work?

From Dev

How those undocumented ANSI codes work

From Dev

How to combine key codes to work together in javascript

From Dev

how do c compilers for android work.

From Dev

How do download managers work on Android?

From Dev

Android Convert Int to Hex Color

From Dev

Android int to Int[] SimpleArc Loader (Color)

From Dev

How do i show such text in c codes or c++ codes?

From Dev

How does Android TextView.SetText(int resid) work?

Related Related

HotTag

Archive