Reputation: 1219
Hello I am noob in Android.
I am using appcompat support library to make my application backward compatible. Here action bar color is Light
by default I want to change the background color to my custom color.
Any idea how to do this ??
styles.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
Upvotes: 0
Views: 636
Reputation: 181
your style might look like this
reference:- https://developer.android.com/training/basics/actionbar/styling.html
<style name="CustomActionBarTheme"
parent="@style/Theme.AppCompat.Light">
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<!-- Support library compatibility -->
<item name="background">@drawable/actionbar_background</item>
</style>
Upvotes: 0
Reputation: 1219
This solved my problem. Thanks @Zohra
ActionBar mActionBar = getActionBar();
mActionBar.setBackgroundDrawable(new ColorDrawable("COLOR"));
Upvotes: 1
Reputation: 2019
You can try to use an approach from official documentation. I think it has clear example how to do it.
Upvotes: 0