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 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示