Change the background color in android app programatically

1. so. The first thing you need to make sure, is that for the content you want to change color on has an ID where you can reference to your program. Something like a  android:id=”@+id/name” so you can find it under resources.

2.  LinearLayout ly = findViewById(R.id.name)

3. ly.setBackgroundColor(Color.WHITE)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s