Set Background color programmatically

user3274646 picture user3274646 · May 7, 2014 · Viewed 252.9k times · Source

I try to set background color programmatically but when I set every one of my colors, the background being black but with any color background being white like the application theme.

View someView = findViewById(R.id.screen);
View root = someView.getRootView();
root.setBackgroundColor(color.white);

Can you see the code?

Answer

Mohanad ALKHOULI picture Mohanad ALKHOULI · May 7, 2014

I didn't understand your question ... what do you mean by "when i set every one of my colour"? try this (edit: "#fffff" in original answer changed to "#ffffff"

  yourView.setBackgroundColor(Color.parseColor("#ffffff"));