How to change a style from code?
I got a style used all across my app, for all buttons. If the user changes the skin of the app, the background of this style should change.
<style name="ActionBtn">
<item name="android:layout_width">@dimen/action_btn_width</item>
<item name="android:layout_height">@dimen/action_btn_height</item>
<item name="android:background">@drawable/btn_frame_bgstate</item>
<item name="android:padding">@dimen/action_btn_padding</item>
<item name="android:layout_margin">@dimen/action_btn_margin</item>
</style>
So far the only idea I got is to make a custom button that itself chooses its background on creation.
I have not found any good, generic way for skinning android apps yet, but if I could change styles from code, that would do the trick.
All suggestions welcome!
1) Create different themes for your skins.
2) Set those themes programatically using following code in your
onCreatemethod.resid is the id of your theme.