Skip to content Skip to sidebar Skip to footer

Modify Existing Theme

I would like to know if it is possible (and how) to customize an existing theme. What I'm looking for is how can I retrieve a certain attribute (i.e. color) and change it when the

Solution 1:

Why not just make your own theme, setting the android:parent to the theme you want to copy, then set your own attributes? That is demonstrated in this documentation, like so:

<?xml version="1.0" encoding="utf-8"?><resources><stylename="CodeFont"parent="@android:style/TextAppearance.Medium"><itemname="android:layout_width">fill_parent</item><itemname="android:layout_height">wrap_content</item><itemname="android:textColor">#00FF00</item><itemname="android:typeface">monospace</item></style></resources>

In this case, the CodeFont style will be identical to the TextAppearance.Medium style, except for the items specified here. You can do the same with any theme, including the default Holo or Dark theme or whatnot.

Solution 2:

Based on further research and Eric's comment there is not yet a possible way to modify a theme programmatically. Different themes can be applied programmatically but not modified. Once the style is set in XML, it cannot be modified.

Post a Comment for "Modify Existing Theme"