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 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败