zxd_72 2012-12-10 07:41 采纳率: 0%
浏览 4354
已采纳

关于Actionbar的下拉列表导航中文本颜色的问题

在程序中可以改变下拉列表导航的背景颜色:

<style name="MyTheme" parent="android:style/Theme.Light">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
    </style>

  <style name="MyDropDownNav" parent="android:style/Widget.Spinner">
        <item name="android:background">@drawable/spinner_white</item>
        <item name="android:textColor">@color/red</item>
    </style>

然而textColor没有变,我又使用别的方法改变 textColor:

<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
        <item name="android:background">?color_actionbar</item>
        <item name="android:titleTextStyle">@style/myTheme.ActionBar.Text</item>
    </style>

  <style name="myTheme.ActionBar.Text" parent="@android:style/TextAppearance">
        <item name="android:textColor">@color/violet</item>
    </style>

大家有什么意见呢?

  • 写回答

2条回答 默认 最新

  • 问答小助手 2012-12-11 08:44
    关注

    在主文件中,给spinnerDropdownItemStyle设置样式

    <style name="YourTheme" parent="YourParentTheme">
        <item name="android:spinnerDropDownItemStyle">@style/YourCustomDropDownItemStyle</item>
    </style>
    

    为 textappearance 设置样式

    <style name="YourCustomDropDownItemStyle" parent="Widget.Holo.DropDownItem.Spinner">
        <item name="android:textAppearance">@style/YourCustomDropDownItemTextStyle</item>
    </style>
    

    在自定义的 textappearance,设置文本细节:

    <style name="YourCustomDropDownItemTextStyle" parent="Widget">
        <item name="android:textColor">@color/white</item>
        <!-- Here you can set the color and other text attributes -->
    </style>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 asp.textbox后台赋值前端不能显示什么原因
  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误