Color of an Android application

2

I'm trying to leave the color of the application as White (by default), but I can not do it ... It is possible? Or do I have to set the color element by element?

I can not also change the color of ActionBar, it follows the relevant code:

<style name="Theme.David" parent="@style/Theme.AppCompat.Light">
    <item name="android:textColor">#FFFFFF</item>
    <item name="android:titleTextStyle">@style/TitleTextStyle.David</item>
    <item name="android:actionBarItemBackground">@drawable/selectable_background_david</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.David</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.David</item>
    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.David</item>
    <item name="android:actionDropDownStyle">@style/DropDownNav.David</item>
    <item name="android:actionBarStyle">@style/ActionBar.Solid.David</item>
    <item name="android:actionModeBackground">@drawable/cab_background_top_david</item>
    <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_david</item>
    <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.David</item>

    <item name="actionBarItemBackground">@drawable/selectable_background_david</item>
    <item name="popupMenuStyle">@style/PopupMenu.David</item>
    <item name="dropDownListViewStyle">@style/DropDownListView.David</item>
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.David</item>
    <item name="actionDropDownStyle">@style/DropDownNav.David</item>
    <item name="actionBarStyle">@style/ActionBar.Solid.David</item>
    <item name="actionModeBackground">@drawable/cab_background_top_david</item>
    <item name="actionModeSplitBackground">@drawable/cab_background_bottom_david</item>
    <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.David</item>
</style>

<style name="ActionBar.Solid.David" parent="@style/Widget.AppCompat.ActionBar">
    <item name="android:titleTextStyle">@style/TitleTextStyle.David</item>
    <item name="android:background">@drawable/ab_solid_david</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_david</item>
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_david</item>
    <item name="android:progressBarStyle">@style/ProgressBar.David</item>

    <item name="background">@drawable/ab_solid_david</item>
    <item name="backgroundStacked">@drawable/ab_stacked_solid_david</item>
    <item name="backgroundSplit">@drawable/ab_bottom_solid_david</item>
    <item name="progressBarStyle">@style/ProgressBar.David</item>
</style>

<style name="TitleTextStyle.David" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
    <item name="android:textColor">#FFFFFF</item>
    <item name="android:textStyle">bold</item>
</style>
    
asked by anonymous 15.09.2014 / 20:37

1 answer

1

When you use a style that uses AppCompat , you must also put all attributes with android: as a prefix, for example:

<style name="ActionBar.Solid.David" parent="@style/Widget.AppCompat.ActionBar">
    <item name="android:titleTextStyle">@style/TitleTextStyle.David</item>
    <item name="titleTextStyle">@style/TitleTextStyle.David</item>
    <item name="background">@drawable/ab_solid_david</item>
    <item name="android:background">@drawable/ab_solid_david</item>
    <item name="backgroundStacked">@drawable/ab_stacked_solid_david</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_david</item>
    <item name="backgroundSplit">@drawable/ab_bottom_solid_david</item>
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_david</item>
    <item name="progressBarStyle">@style/ProgressBar.David</item>
    <item name="android:progressBarStyle">@style/ProgressBar.David</item>
</style>

Detail: If you are using minSdk as 11 you do not need to use AppCompat in your styles. In this case, you could leave only the attributes with the prefix android: on the front, removing the ones that do not have, for example:

<style name="ActionBar.Solid.David" parent="@style/Widget.Holo.ActionBar">
    <item name="android:titleTextStyle">@style/TitleTextStyle.David</item>
    <item name="android:background">@drawable/ab_solid_david</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_david</item>
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_david</item>
    <item name="android:progressBarStyle">@style/ProgressBar.David</item>
</style>
    
15.09.2014 / 21:18