djk
djk

Reputation: 3691

change actionbar spinner textcolor

How can i change the actionbar spinner textcolor. I have created it with xml file in menu folder. When it shows dropdown its textcolor is white and i have changed it with custom adapter. but how to change textcolor when its close? please see the screenshot. today Jul02 is the spinner i want to change that black color to white

Here is the menu xml file code

 <?xml version="1.0" encoding="utf-8"?>
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
 <item
    android:id="@+id/action_map_spinner"
    android:showAsAction="ifRoom"
    android:actionLayout="@layout/actionbar_spinner"  />

<item
    android:id="@+id/btnAction"
    android:icon="@drawable/ic_action_overflow"
    android:showAsAction="always">
    <menu>
        <item
            android:id="@+id/btnSettings"
            android:title="@string/right_menu_settings"/>
        <item
            android:id="@+id/btnShare"
            android:title="@string/right_menu_Share"/>
        <item
            android:id="@+id/btnRate"
            android:title="@string/right_menu_rate"/>
        <item
            android:id="@+id/btnRemoveAds"
            android:title="@string/right_menu_remove"/>
        <item
            android:id="@+id/btnFeedback"
            android:title="@string/right_menu_feedback"/>
        <item
            android:id="@+id/btnMoreApps"
            android:title="@string/right_menu_more_apps"/>
        <!-- <item -->
        <!-- android:id="@+id/btnAddAppointment" -->
        <!-- android:icon="@drawable/ic_launcher" -->
        <!-- android:title="Add Appointment"/> -->
    </menu>
  </item>
 </menu>

Upvotes: 3

Views: 1381

Answers (2)

Pragnesh Ghoda  シ
Pragnesh Ghoda シ

Reputation: 8337

To modify the color of text in the action bar, you need to override separate properties for each text element..

refer to this link..

Customize the Text Color

Custom Theme :

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@style/Theme.Holo">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
        <item name="android:actionMenuTextColor">@color/actionbar_text</item> <!-- Change color here -->
    </style>

</resources>

This may help you..

Upvotes: 1

djk
djk

Reputation: 3691

1 line of code solved my problem. and here is the screen shot.

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
 <item name="android:actionMenuTextColor">@color/actionbar_text</item>
</style>

enter image description here

Upvotes: 0

Related Questions