其他分享
首页 > 其他分享> > 如何在android中更改sherlock actionbar overflow-dropdown项目的文本颜色?

如何在android中更改sherlock actionbar overflow-dropdown项目的文本颜色?

作者:互联网

以下是我如何更改sherlock actionbar overflow-dropdown菜单的背景颜色.如何更改下拉项目文本颜色和重力?请帮我.目前文字颜色为黑色.

<style name="AppBaseTheme" parent="@style/Theme.Sherlock.Light.ForceOverflow">

</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">  
    <item name="android:actionOverflowButtonStyle">@style/CustomActionOverFlowStyle</item>
    <item name="actionOverflowButtonStyle">@style/CustomActionOverFlowStyle</item>
    <item name="actionButtonStyle">@style/CustomActionButtonStyle</item>
    <item name="android:actionButtonStyle">@style/CustomActionButtonStyle</item>
     <item name="android:dropDownListViewStyle">@style/CustomDropDownListView</item>
    <item name="dropDownListViewStyle">@style/CustomDropDownListView</item>

</style>

<style name="CustomDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown">
    <item name="android:background">@color/abs__bright_foreground_disabled_holo_dark</item> <!-- this works -->
    <item name="android:textColor">@color/white</item> <!-- but this is not working -->
    <item name="android:divider">@color/app_bg_color</item>
    <item name="android:dividerHeight">0.5dp</item>
    <item name="android:dividerPadding">1dp</item>
    <item name="android:gravity">right</item>
</style>

解决方法:

终于以这种方式解决了.但是,我没有测试对ActionBar上其他小部件的影响:

<item name="android:actionBarWidgetTheme">@style/CustomActionOverflowDropDownText</item>
<item name="actionBarWidgetTheme">@style/CustomActionOverflowDropDownText</item>

<style name="CustomActionOverflowDropDownText" parent="Widget">
    <item name="android:textColor">@color/app_bg_color</item>
    <item name="android:gravity">right</item>
</style>

标签:android,android-styles,drop-down-menu,actionbarsherlock
来源: https://codeday.me/bug/20190831/1776178.html