改变Spinner的风格

时间:2014-09-30 07:36:17

标签: android layout spinner

我试图改变我的多选微调器的样式。我可以改变微调器的背景,但我不能改变文本颜色和按钮背景。这是我的代码: styles.xml

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:alertDialogStyle">@style/CustomDialogTheme</item>
    <item name="android:spinnerDropDownItemStyle">@style/CustomDialogTheme</item>
    <item name="android:spinnerItemStyle">@style/CustomDialogTheme</item>
    <item name="android:spinnerStyle">@style/CustomDialogTheme</item>
</style>
<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog">
    <item name="android:bottomBright">@color/white</item>
    <item name="android:bottomDark">@color/white</item>
    <item name="android:bottomMedium">@color/white</item>
    <item name="android:centerBright">@color/white</item>
    <item name="android:centerDark">@color/white</item>
    <item name="android:centerMedium">@color/white</item>
    <item name="android:fullBright">@color/white</item>
    <item name="android:fullDark">@color/white</item>
    <item name="android:topBright">@color/white</item>
    <item name="android:topDark">@color/white</item>
    <item name="android:textColor">@color/blue</item>
</style>

现在,我的微调器看起来像: enter image description here

我想更改文字颜色(<item name="android:textColor">@color/blue</item>不起作用)和按钮背景和复选框颜色。有没有办法在没有定义自己的LayoutInflater(Why does LayoutInflater ignore the layout_width and layout_height layout parameters I've specified?)或创建数组适配器的子类(How to change font style for spinner item)的情况下这样做?

1 个答案:

答案 0 :(得分:0)

你可以看到我的github项目。我认为这对你有太大帮助。

Custom Spinner

Custome Checkbox