tags:

views:

73

answers:

1

How can you change application colors on the fly?

I am currently using the following to change the background: LinearLayout mScreen = (LinearLayout) findViewById(R.id.main); mScreen.setBackgroundColor( mycolor );

I tried to use Style's to change the text using: @color/white

The problem is that Spinners/Buttons and Spinner-Popup-Lists all change to white text as well, making them unreadable. I have over 20 Classes in my app that all need to be able to change color combination's.

A: 

One way to do this is to create several themes. To apply a theme at runtime, call setTheme in your activities' onCreate methods (before setContentView). You can force re-creation and thus re-theming of your activity by doing something like:

startActivity(getIntent());
finish();
Roman Nurik
That is what I did using a Style. The problem is that when text is set to white, "<item name="android:textColor">@color/white</item>" all the text on the screen turns white, including popup spinners - white text on white background.
miannelle