A
A
Artem2013-08-03 00:28:38
Android
Artem, 2013-08-03 00:28:38

How to change the theme for Spinner?

In my application, the background of the Activity changes, depending on the actions taking place inside the application. The app theme is Holo.Light. The background of the activity can be dark or light. This activity has a Spinner. The problem is that when the background is dark, the Spinner starts to blend into the background. This is due to the fact that it has a high transparency.
Is it possible somehow to change the theme for a single View programmatically? That is, so that when the background is light, let the style from Holo.Light be used for the Spinner as well. But when the background turns dark, you need the Spinner to use the style from the Holo dark theme. How to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bimeg, 2013-08-03
@bartwell

For example like this:

onCreate(...)
{
    if (dark)
    {
        setTheme(R.style.dark);
    }
    else
    {
        setTheme(R.style.light);
    }
...
}

<style name="dark" parent="android:Theme.Holo">
...
</style>

<style name="light" parent="android:Theme.Holo.Light">
...
</style>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question