I know this question must be asked before, but I don't know where can I find the solution since I don't know what is the name.
I want to change the color to red. How can I do to achieve this ?
Thanks a lot !
I know this question must be asked before, but I don't know where can I find the solution since I don't know what is the name.
I want to change the color to red. How can I do to achieve this ?
Thanks a lot !
A style on Android contains a number of different attributes. This can control background color, text color, font styling, etc.
The Theme.AppCompat.Light.DarkActionBar
style contains several attributes for an overall light theme with a dark colored action bar.
If the background color you want to use needs white text and icons on top of it, you reference this as the parent and just change the background color.
<item name="android:background">#ff0000</item>
If your background color would look better with black (or dark) text, you could set the parent to Theme.AppCompat.Light
.
If you want to change the color of the application bar (and the application's primary color – the application bar inherits it), just change your colorPrimary
attribute. Like this:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/yourColorResource</item>
</style>
Instead of @color/yourColorResource
, you can directly use a color's hexcode or Android's pre-defined resources such as @android:color/holo_red_dark
For the status bar's color, you can use similarly use the colorPrimaryDark
attribute. You can read more about this here.