Change basic theme color of android application

ε祈祈猫儿з 提交于 2020-01-09 08:14:32

问题


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?


回答1:


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>



回答2:


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>


来源:https://stackoverflow.com/questions/9688724/change-basic-theme-color-of-android-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!