Set appcompat icon and title text color using styles:
xml
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarStyle">@style/MyActionBar</item>
<item name="navigationIcon">@drawable/ic_launcher</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="titleTextStyle">@style/TitleTextStyle</item>
<item name="displayOptions">showHome|showTitle</item>
</style>
<style name="TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#A52421</item>
</style>
Set appcompat icon and title text color programmatically:
To set the color on the ActionBar title you need to use SpannableString. The icon is not showing becuase appcompat-v7 sets setDisplayShowHomeEnabled to false by default. Add the following code after you call super.onCreate(Bundle):
java
SpannableString spannableString = new SpannableString(getString(R.string.app_name));
spannableString.setSpan(new ForegroundColorSpan(Color.RED), 0, spannableString.toString()
.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.drawable.ic_launcher);
getSupportActionBar().setTitle(spannableString);