I'm trying to define a theme for an appwidget, and have it applied at the application level. I have a theme like,
<style name="theme.dark">
<item name="android"background">#000000</item>
</style>
in my manifest, I set android:theme="@style/theme.dark"
at the application. however, when I run the appwidget, it does not pick up the items from the style. I tried setting style="@style/theme.dark"
on an individual element in my view layout, and that does work ... but that's not what I want. I don't want to call out a specific style="..." for each element in my view. this page,
http://www.androidengineer.com/2010/06/using-themes-in-android-applications.html
has an excellent example app for using themes / styles, and it works perfectly. the only difference is that it's an application .. and it's setting the theme on the activity, not the application.
I've also tried setting the theme at programmatically on the Context object using setTheme(...) in onHandleUpdate() of the appwidget, before the view is accessed. that doesn't work either.
Any ideas?
The answer is that you can't apply a theme dynamically to an appwidget. There's no solution other than providing multiple layouts each statically referencing a particular theme, then picking the correct theme/layout when you build your remote views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With