I fear that allowing the user to dynamically select a new skin (even
with a restart of your app) is a very very difficult thing to do, if
not impossible.

There is a method called 'Activity.setTheme(int resourceId)', but this
changes only the theme and would allow for dynamically changing only a
small sub-set of all possible properties/attributes on views. There
are no methods like 'View.setStyle(int resourceId)' or similar ones
nor is it possible to program a dynamic selection of a particular
custom made configuration.

(Try to search for 'setTheme' in this group and you'll see that there
are(/were?) some issues this method.)

If i'm wrong, i'd love to know how one can implement user-selectable
skins.

On Sep 7, 6:07 am, mort <[email protected]> wrote:
> OK, found a working solution - no idea if it was indented that way,
> SDK documentation is very fuzzy and incomplete in this area...
>
> To stay with my example:
> In attrs.xml, define the "CSS class" ;):
> <resources>
>         <attr name="headline" format="reference" />
> </resources>
>
> In styles.xml, define the style to use for each theme:
> <style name="Theme.Android.Black" parent="android:Theme.Black">
>         <item name="android:textViewStyle">@style/textForBlack</item>
>         <item name="headline">@style/headlineForBlack</item>
> </style>
> <style name="Theme.Android.Light" parent="android:Theme.Light">
>         <item name="android:textViewStyle">@style/textForLight</item>
>         <item name="headline">@style/headlineForWhite</item>
> </style>
>
> In the layout, refer to the attribute with "?":
> <TextView ..... style="?headline" />
>
> Hope this helps other people with similar problems...
>
> On a related topic: Does anybody have an idea how to support themes
> from external (ZIP?) files including the required drawables? Or, in
> other words, user skins.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to