Im working on my actionbar and I'm trying to change the style, I want the background white and the text color blue, Im doing the following to the style.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/action_bar</item>
<item name="colorAccent">@color/top_bar</item>
<item name="colorPrimaryDark">@color/cyan_500</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar"
parent="@style/Widget.AppCompat.Light.ActionBar">
<item name="android:actionBarSize">20dp</item>
<item name="android:background">@color/white</item>
<item name="android:titleTextStyle">@style/MyTitleTextBarStyle</item>
</style>
<style name="MyTitleTextBarStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/colorRB</item>
</style>
</resources>
And nothing is happening, is for API 15 to 22. I have managed to change the background by code doing this:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reasonlocation);
android.support.v7.app.ActionBar mAb = getSupportActionBar();
mAb.setTitle(getString(R.string.reasonandlocation));
mCd.setColor(getResources().getColor(R.color.white));
mAb.setBackgroundDrawable(mCd);
...
}
If you know how can I solve this, either by style.xml or by code, I will appreciate.