I’m trying to set the background of a very simple layout:
LinearLayout ll = (LinearLayout) findViewById(R.id.simple_layout);
This works:
ll.setBackgroundColor(Color.WHITE);
But this doesn’t:
ll.setBackgroundColor(R.color.white);
And yes, I verified that R.color.white is defined in a colors.xml file under /res/values.
What am I missing?
You need to use
ll.setBackgroundResource(R.color.white)