Question

I created a custom theme for the action bar that makes it white, and having a tad bit of trouble, and I have not been able to find the solution. First of all I want the 'options button' to be red, like the text below. but especially I want when clicked the whole row to be highlighted, not like it is shown in the picture:

Exmample

Sso here is the code for the theme I'm using:

<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="MyCustomTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/MyActionBarTheme</item>
        <item name="android:background">@color/White</item>
        <item name="android:textColorLink">@color/White</item>
    </style>

    <style name="MyActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">@color/White</item>
        <item name="android:textColor">@color/Red</item>
    </style>
</resources>

I was hoping I could also get the red text to be aligned right, and have tried multiple alignment methods with no luck.thanks.

Was it helpful?

Solution

You need styles for android:actionMenuTextColor to change the "options" text color and android:textAppearanceLargePopupMenu to change the PopupMenu text color.

<style name="Your.Theme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionMenuTextColor">@android:color/holo_red_dark</item>
    <item name="android:textAppearanceLargePopupMenu">@style/TextAppearance.Red.PopupMenu.Large</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.Example</item>
</style>

<style name="TextAppearance.Red.PopupMenu.Large" parent="@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Large">
    <item name="android:textColor">@android:color/holo_red_dark</item>
</style>

<style name="PopupMenu.Example" parent="@android:style/Widget.ListPopupWindow">
    <item name="android:popupBackground">@drawable/your_background</item>
    <!-- Or use -->
    <item name="android:popupBackground">@android:color/white</item>
</style>

Example

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