Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Providing Styles Resources for Gingebread
    primarykey
    data
    text
    <p>I am having some troubles to provide different styles resources for gingerbread or older versions of android. </p> <p>I have defined 2 different style pages. the normal Styles and the Styles-v11. For android 3.0 and UP works just fine, everything is OK. My problem is when I try on gingerbread it just ignores the style changes.</p> <p>Styles:</p> <pre><code>&lt;resources xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;!-- Styles for v1 to v10 --&gt; &lt;style name="AppBaseTheme" parent="android:Theme.Light"&gt;&lt;/style&gt; &lt;style name="DarkTheme" parent="android:Theme"&gt;&lt;/style&gt; &lt;style name="Performance" parent="android:Theme"&gt;&lt;/style&gt; &lt;style name="LightTheme" parent="android:Theme.Light"&gt;&lt;/style&gt; &lt;style name="ColorsTheme" parent="android:Theme.Holo"&gt;&lt;/style&gt; &lt;style name="OsuTheme" parent="android:Theme.Light"&gt;&lt;/style&gt; &lt;style name="BrazilTheme" parent="android:Theme"&gt;&lt;/style&gt; &lt;style name="NeonTheme" parent="android:Theme"&gt; &lt;item name="android:windowBackground"&gt;@android:color/black&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>Styles-v11:</p> <pre><code>&lt;resources xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;!-- Styles v11 --&gt; &lt;style name="AppBaseTheme" parent="android:Theme.Light"&gt;&lt;/style&gt; &lt;style name="DarkTheme" parent="android:Theme.Holo"&gt;&lt;/style&gt; &lt;style name="Performance" parent="android:Theme.Holo"&gt;&lt;/style&gt; &lt;style name="LightTheme" parent="android:Theme.Holo.Light"&gt;&lt;/style&gt; &lt;style name="ColorsTheme" parent="android:Theme.Holo"&gt;&lt;/style&gt; &lt;style name="OsuTheme" parent="android:Theme.Holo.Light"&gt;&lt;/style&gt; &lt;style name="BrazilTheme" parent="android:Theme.Holo"&gt;&lt;/style&gt; &lt;style name="NeonTheme" parent="android:Theme.Holo"&gt; &lt;item name="android:windowBackground"&gt;@android:color/black&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>My app have a settings to check which theme is active. </p> <pre><code>switch (ThemesActivity.newTheme) { case ThemesActivity.THEME_DARK: setTheme(R.style.DarkTheme); setContentView(R.layout.activity_main_dark); break; case ThemesActivity.THEME_LIGHT: setTheme(R.style.LightTheme); setContentView(R.layout.activity_main_light); break; case ThemesActivity.THEME_COLORS: setTheme(R.style.ColorsTheme); setContentView(R.layout.activity_main_colors); break; case ThemesActivity.THEME_NEON: setTheme(R.style.NeonTheme); setContentView(R.layout.activity_main_neon); break; case ThemesActivity.THEME_PERF: setTheme(R.style.Performance); setContentView(R.layout.activity_main_performance); break; case ThemesActivity.THEME_OSU: setTheme(R.style.OsuTheme); setContentView(R.layout.activity_main_osu); break; case ThemesActivity.THEME_BRAZIL: setTheme(R.style.BrazilTheme); setContentView(R.layout.activity_main_brazil); break; default: setTheme(R.style.DarkTheme); setContentView(R.layout.activity_main_dark); break; } </code></pre> <p>The problem is doesn't matter which theme is active in Gingerbread! ALWAYS loads the default app theme :( </p> <p>I can't figure out what is going on wrong and why the theme change is not working for older versions. </p> <p>Thank you very much.</p> <p>edit:</p> <p>I've tried also using:</p> <pre><code> &lt;style name="OsuTheme" parent="@android:style/Theme.Light"&gt;&lt;/style&gt; </code></pre> <p>And still the same :( the theme doesn't change at run time, it only changes if I set the theme on the manifest. </p> <p>On the manifest the themes work fines, the problem is when I try to change it during runtime.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload