diff --git a/docs/html/guide/topics/ui/themes.jd b/docs/html/guide/topics/ui/themes.jd index de699f23297c6..57c9f2e32c067 100644 --- a/docs/html/guide/topics/ui/themes.jd +++ b/docs/html/guide/topics/ui/themes.jd @@ -17,6 +17,7 @@ parent.link=index.html
If you like a theme, but want to tweak it, just add the theme as the parent
-of your custom theme. For example, you can modify the traditional dialog theme to use your own
-background image like this:
-<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog"> - <item name="android:windowBackground">@drawable/custom_dialog_background</item> +<color name="custom_theme_color">#b0b0ff</color> +<style name="CustomTheme" parent="android:Theme.Light"> + <item name="android:windowBackground">@color/custom_theme_color</item> + <item name="android:colorBackground">@color/custom_theme_color</item> </style>-
Now use {@code CustomDialogTheme} instead of {@code Theme.Dialog} inside the Android +
(Note that the color needs to supplied as a separate resource here because
+the android:windowBackground attribute only supports a reference to
+another resource; unlike android:colorBackground, it can not be given
+a color literal.)
Now use {@code CustomTheme} instead of {@code Theme.Light} inside the Android Manifest:
-<activity android:theme="@style/CustomDialogTheme"> +<activity android:theme="@style/CustomTheme">+
Newer versions of Android have additional themes available to applications, +and you may want to use these while running on those platforms while still being +compatible with older versions. You can accomplish this through a custom theme +that uses resource selection to switch between different parent themes.
+ +For example, here is the declaration for a custom theme which is simply
+the standard platforms default light theme. It would go in an XML file under
+res/values (typically res/values/styles.xml):
+
+<style name="LightThemeSelector" parent="android:Theme.Light"> +</style> ++ +
To have this theme use the newer "holo" theme when the application is running
+on {@link android.os.Build.VERSION_CODES#HONEYCOMB}, you can place another
+declaration for it in a file in res/values-11:
+<style name="LightThemeSelector" parent="android:Theme.Holo.Light"> +</style> ++ +
Now use this theme like you would any other, and your application will +automatically switch to the holo theme if running on +{@link android.os.Build.VERSION_CODES#HONEYCOMB} or later.
+ +A list of the standard attributes that you can use in themes can be +found at {@link android.R.styleable#Theme R.styleable.Theme}.