How to set background color of a View

Posted by Peter vdL on Stack Overflow See other posts from Stack Overflow or by Peter vdL
Published on 2010-01-31T23:55:29Z Indexed on 2010/05/28 19:42 UTC
Read the original article Hit count: 227

Filed under:
|
|
|
|

I'm trying to set the background color of a View (in this case a Button).

I use this code:

// set the background to green
v.setBackgroundColor(0x0000FF00 );
v.invalidate();

It causes the Button to disappear from the screen. What am I doing wrong, and what is the correct way to change the background color on any View?

Thanks.

© Stack Overflow or respective owner

Related posts about android

Related posts about view