Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling Action Bar Text Color - Android

<style name="Theme.RateItTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:titleTextStyle">@style/MyActionBar.Text</item>
</style>

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">#2E495E</item>
</style>

<style name="MyActionBar.Text" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">#ECECEC</item>
</style>

I have been able to change the background, but not the text color. Or the overflow menu "three dots". My code is above.

like image 970
TheLettuceMaster Avatar asked Jun 24 '12 22:06

TheLettuceMaster


People also ask

How can I customize my action bar in Android?

This example demonstrate about how to create a custom action bar in Android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

How do you change the color of your toolbar on Android?

toolbar. setBackgroundColor(Color. parseColor("#80000000"));


2 Answers

You need to move your titleTextStyle attribute into your MyActionBar style. Do you understand why it's supposed to be placed there rather than where you had it originally?

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">#2E495E</item>
    <item name="android:titleTextStyle">@style/MyActionBar.Text</item>
</style>

As far as changing the Overflow icon, I think that's what mean when you say "three dots", I've already written a post about that here.

like image 136
adneal Avatar answered Oct 02 '22 11:10

adneal


Try this

<?xml version="1.0" encoding="utf-8"?>
<!-- For honeycomb and up -->
<resources>

    <style name="Theme.RateItTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="android:actionMenuTextColor">@color/actionBarText</item>
    </style>

    <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">#2E495E</item>
        <item name="android:titleTextStyle">@style/MyActionBar.Text</item>
    </style>

    <style name="MyActionBar.Text" parent="@android:style/TextAppearance">
        <item name="android:textColor">#ECECEC</item>
    </style>

</resources>
like image 28
K_Anas Avatar answered Oct 02 '22 10:10

K_Anas