styling ActionbarSherlock: textColor of the action-items

[亡魂溺海] 提交于 2019-12-10 16:38:38

问题


I was changing the background of the Actionbar in my App and to make text readable again I have to change the color of the text. I was successful with title/subtitle and the tab-texts, but I am struggling with the text of the action-items - they stay white no matter what I tried . Anyone has a hint on how to do that? Also the overflow-icon is white which does not look too good on the wooden background - is that an extremely good reason to use the stuff below? I am not really sure what's the reason to not do it, but as I do not have a big device-test-park I better want to be sure ;-)

<!-- the following can be used to style the overflow menu button
     only do this if you have an *extremely* good reason to!! -->
<!--<style name="MyOverflowButton" parent="Widget.Sherlock.ActionButton.Overflow">
    <item name="android:src">@drawable/ic_menu_view</item>
    <item name="android:background">@drawable/action_button_background</item>
</style>-->

回答1:


Try starting with android:theme="@style/Theme.Sherlock.Light" in your Manifest and then changing your styles. The light theme features dark action items. Or just look through the light theme to find out how to change them.




回答2:


I also struggled with this, but the solution to changing action item text color was:

<style name="My.Theme" parent="Theme.Sherlock.Light">
    <item name="android:actionMenuTextColor">@android:color/white</item>
</style>

The key here was to use this attribute in the general theme, not in the actionbar style.



来源:https://stackoverflow.com/questions/10062012/styling-actionbarsherlock-textcolor-of-the-action-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!