android:background="@drawable/nebula
private int colorCode = 0;
protected void onClick(View view) { LinearLayout layout = (LinearLayout) findViewById(R.id.layout); colorCode = (colorCode + 1) % 3; if (colorCode == 1) { layout.setBackgroundColor(getResources( ).getColor(R.color.lightBlue)); } else if (colorCode == 2) { layout.setBackgroundColor(getResources( ).getColor(R.color.lightPink)); } else { layout.setBackgroundColor(getResources( ).getColor(R.color.lightGreen)); } }