如何在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>
更改颜色的唯一方法是使用自定义的Android主题。你必须按照这里提到的添加你的风格,然后把上面的代码放在你的风格文件中:
<?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>
这只在Windows和MobileWeb上可用,正如文档所说:https://appcelerator.github.io/appc-docs/platform/latest/#/api/Tatitanium.UI.PickerRow-属性颜色