Change basic theme color of android application
Asked Answered
C

2

3

Every android application/theme hast it's own basic theme color:

HTC Desire Z - green,

most Samsung deviced - yellow,...

It's the color of selected list items, option menu-radio button, radio button, progress-bars,....

I know how to change these colors individual. But is there a way to change all of them by setting one value?

Something like:

<style name="my_theme" parent="@android:style/Theme.Black">
      <item name="android:_DEFAULT_BASE_COLOR_1">#XXXXXX</item>
</style>

//EDIT:

So I'm looking for the keyword of _DEFAULT_BASE_COLOR_1, where I can set a color for radio button, slected list item with only one item. Is it possible?

Component answered 13/3, 2012 at 17:10 Comment(0)
G
0

In your manifest in application tag define as :

    android:theme="@style/mytheme"

Now in res/values you can define a file say theme.xml with content as :

<resources> 
    <style name="mytheme" parent="@android:style/Theme" > 
       <item name="android:_DEFAULT_BASE_COLOR_1">#XXXXXX</item>
       <item name="android:windowNoTitle">true</item>
        ... . 
    </style>
</resources>
Gratifying answered 13/3, 2012 at 17:30 Comment(5)
that's what I already have :) I'm looking for the right keyword of '_DEFAULT_BASE_COLOR_1'Component
all of these generally have 9-patch images for it, rather than color definition. For e.g focussed Edit text you would see orange/blue in various devices..thats not color but all are drawables....You would have to modify each of them , like say for edit text <item name="android:editTextStyle">___mystyle___ </item>Gratifying
taking your comment "You would have to modify each of them", meas there it's not possible to override the 'default' drawables for all once, because even in the 'standard theme' there are different drawables?Component
yup..there is nothing 'default' drawables in sdk... you can even actually see the drawables by looking in the android-sdk code of yours..in res/drwawable* directories of sdk...Gratifying
what is meant by android:_DEFAULT_BASE_COLOR_1 here? why this answer has been marked as accepted?Senzer
V
0

try this:

    <style name="my_theme" parent="@android:style/Theme.Black">
        <item name="listChoiceIndicatorSingle">xxxxxxx</item>
<item name="radioButtonStyle">xxxxxxx</item>
<item name="listChoiceBackgroundIndicator">xxxxxxx</item>
<item name="listViewStyle">xxxxxxx</item>
<item name="listDivider">xxxxxxx</item>
<item name="listSeparatorTextViewStyle">xxxxxxx</item>
    ....
    </style>
Vitia answered 13/3, 2012 at 18:2 Comment(1)
well, that's what I'm trying to avoid (setting all styles manual). Besides that, a style doesn't take the listViewStyle and radioButtonStyle :)Component

© 2022 - 2024 — McMap. All rights reserved.