Question

I want to change the color of the text of menu items in the action bar. I' tried to change the theme but nothing works. I'm ussing API 19:

This is my res\values\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="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>

    <style name="LoginFormContainer">
        <item name="android:padding">28dp</item>
    </style>
</resources>

Also the project generated styles.xml in res\values-v11\ res\values-v14\

I don't know if I have to change the theme or just set a property or something, any help I will really appreciate. Thank you!

Was it helpful?

Solution

Finally I found a solution to my problem. This is my final code:

<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <!--
        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.
    -->
    <style name="AppBaseTheme" parent="Theme.AppCompat.Light">
        <!-- API 14 theme customizations can go here. -->
        <item name="android:textAppearanceLargePopupMenu" >@style/m_textAppearanceLargePopupMenu</item>
        <item name="android:textAppearanceSmallPopupMenu" >@style/m_textAppearanceSmallPopupMenu</item>
    </style>

    <style name="m_textAppearanceLargePopupMenu" parent="@android:style/TextAppearance.Holo.Widget.PopupMenu.Large">
        <item name="android:textColor">#009ad2</item>
    </style>
    <style name="m_textAppearanceSmallPopupMenu" parent="@android:style/TextAppearance.Holo.Widget.PopupMenu.Small">
        <item name="android:textColor">#009ad2</item>
    </style>

</resources>

It is my res\values-v14\ file code.

I was confused, what I really wanted was to change the text color to the PopupMenu and it worked for me.

Thanks friends for your help!!

OTHER TIPS

Check this Documentation in the section Customize the Text Color. It says the way you have to do it for the different android API levels.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top