安卓:在哪里微调控件的文本颜色属性隐藏? [英] Android: Where is the Spinner widget's text color attribute hiding?

查看:206
本文介绍了安卓:在哪里微调控件的文本颜色属性隐藏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变后,你从下拉一个项目,显示在微调按钮单项的文本颜色。我已经仔细阅读在Android SDK中的themes.xml和styles.xml了一个小时了,我似乎无法找到地方微调渐从颜色值。

I'm trying to change the text color of the single item that is displayed in the spinner button after you select an item from the dropdown. I've been perusing the themes.xml and styles.xml in the Android SDK for an hour now, and I can't seem to find where the Spinner is getting the color value from.

要澄清,我并不想改变一个下拉列表项的颜色,我试图改变微调的显示文本的颜色时,有没有下拉菜单。我想你可以把它叫做微调的按钮的文字。

To clarify, I'm NOT trying to change the color of a dropdown item, I'm trying to change the color of the spinner's displayed text when there is no dropdown. I guess you could call it the spinner's 'button' text.

推荐答案

我觉得它可能是在styles.xml该位

I think it's probably this bit in styles.xml

<style name="Widget.TextView.SpinnerItem">
    <item name="android:textAppearance">@style/TextAppearance.Widget.TextView.SpinnerItem</item>
</style>
<style name="Widget.DropDownItem.Spinner">
    <item name="android:checkMark">?android:attr/listChoiceIndicatorSingle</item>
</style>

- =编辑= - 这里的结果:

-= EDIT =- Here's the result:

和这里是它是如何做的:

and here's how it's done:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MooTheme" parent="android:Theme">
        <item name="android:spinnerItemStyle">@style/MooSpinnerItem</item>
    </style>

    <style name="MooSpinnerItem" parent="android:Widget.TextView.SpinnerItem">
        <item name="android:textAppearance">@style/MooTextAppearanceSpinnerItem</item>
    </style>

    <style name="MooTextAppearanceSpinnerItem" parent="android:TextAppearance.Widget.TextView.SpinnerItem">
        <item name="android:textColor">#F00</item>
    </style>
</resources>

然后,只需将它添加到应用程序标签在你的Andr​​oidManifest.xml

Then just add this to the application tag in your AndroidManifest.xml

android:theme="@style/MooTheme"

这篇关于安卓:在哪里微调控件的文本颜色属性隐藏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆