将拾取器行标题从黑色更改为白色

时间:2015-12-01 12:20:27

标签: javascript titanium appcelerator appcelerator-titanium appcelerator-alloy

如何在Android上将Picker Row标题从黑色更改为白色?我尝试使用TSS并在XML中使用属性但没有成功。

XML

<Alloy>
    <View top="80" height="70">
        <Label class="calendarViewDayDay" top="5" left="10" color="#FFFFFF" text="L('Rooms')"></Label>
        <Picker id="Numberpicker2" top="20" left="10">
            <PickerColumn>
                <PickerRow title="1" />
                <PickerRow title="2" />
                <PickerRow title="3" />
                <PickerRow title="4" />
                <PickerRow title="5" />
                <PickerRow title="6" />
                <PickerRow title="7" />
                <PickerRow title="8" />
                <PickerRow title="9" />
                <PickerRow title="10" />
            </PickerColumn>
        </Picker>
    </View>
</Alloy>

2 个答案:

答案 0 :(得分:4)

更改颜色的唯一方法是使用自定义Android主题。您必须按照提到的here添加您的样式,然后将上面的代码放在样式文件中:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.CustomTheme" parent="Theme.AppCompat">
        <item name="android:spinnerItemStyle">@style/MySpinnerItem</item>
    </style>
    <style name="MySpinnerItem" parent="@android:style/Widget.TextView.SpinnerItem">
        <item name="android:textColor">your_color_in_hex</item>
    </style>
</resources>

答案 1 :(得分:2)