Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionSherlockBar Styling - PopupMenu

Styling is a place for improvement in my knowledge of the android platform. Given I've being trying to make a simple change all morning and been unable to achieve it.

I want to change the style of the overflow menu in the action bar. I have been able to change the background color, and add animations, so that when clicked it fades to a selected colour. But for the life of me I cannot change the text colour.

Below are two screenshots, one using the Theme.Sherlock and the other using Theme.Sherlock.Light.

Theme.Sherlock - This is my current setting which I have customised. What I want is the overflow (aka android:popupmenu) to be in the holo theme (as below), and ideally so that I can change the text colour.

Theme.Sherlock

Theme.Sherlock.Light - This theme shows the style of overflow menu that I want to see. However, as highlighted in red, the overflow button is the wrong colour, and this theme also draws a horizontal line.

Theme.Sherlock.Light

I don't know whether it is best/easier to change Theme.Sherlock with the popup issue, or Theme.Sherlock.Light with the overflow icon and line issue. The application is of a "Light" theme so option two is probably the long term better choice, however i'll accept an answer that can solve the problem by changing either theme.

p.s. Where do you find a list of attributes for changing theme/styles, auto-complete is very incomplete in eclipse.

Update

This is actually an update for native action bars as im back to the same problem, but no longer supporting 2.3 or below.

<style name="AppTheme" parent="android:Theme.Holo.Light">
  <item name="android:actionOverflowButtonStyle">@style/OverFlow</item>
</style>

<style name="OverFlow" parent="@android:style/Widget.Holo.ActionButton.Overflow">
  <item name="android:src">**Insert your icon here**</item>
</style>
like image 589
JonWillis Avatar asked Jul 30 '12 12:07

JonWillis


1 Answers

This answer is probably coming too late, but to those who may stumble across this question. I find it interesting that you were able to change the overflow's background color. I found that extremely difficult to figure out whereas changing the text was pretty straight forward. Just override the android:itemTextAppearance value in your custom theme.

<item name="android:itemTextAppearance">@style/your_new_text_appearance</item>

<style name="your_new_text_appearance">
    <item name="android:textColor">@color/red</item>
</style>
like image 98
Jay Soyer Avatar answered Sep 23 '22 00:09

Jay Soyer