Android Change Background Color

Android Change Background Color

You want to change the background color of Android layout. It can be set at design time or runtime. Let’s see we can change the color of layout dynamically.

View v = (View) findViewById(;

Complete code.

public void onCreate(Bundle savedInstanceState) {
    View v = (View) findViewById(;

Above program loads the screen with default color white. You can write the code on button click to change the color.


Android Change Background ColorAndroid screen navigation example using Activity and IntentAndroid WebView ExampleAndroid EditText TutorialAndroid Button onClickListener ExampleAndroid Button ClickJQuery how to change background imageAndroid Tutorial For BeginnersBest Android ApplicationsHow to change your IPHow to change facebook name


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.