[英]Change font colour of picker on iOS in Titanium
You should take a look at themes attributes like below: 您应该看一下以下主题属性:
<style name="PickerTheme" parent="Theme.AppCompat.Light">
<item name="android:spinnerItemStyle">@style/SpinnerItem</item>
<item name="android:spinnerDropDownItemStyle">@style/SpinnerDropDownItem</item>
</style>
<!-- Use this style for Spinners/Plain Pickers in default state -->
<style name="SpinnerItem">
<item name="android:textColor">#ff0000</item>
</style>
<!-- Use this style for Spinners/Plain Pickers in selected/popup state -->
<style name="SpinnerDropDownItem">
<item name="android:textColor">#ffffff</item>
<item name="android:background">#20767a</item>
</style>
When creating a PickerRow, you can set the color property: 创建PickerRow时,可以设置color属性:
http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.PickerRow-property-color http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.PickerRow-property-color
If that doesn't work, then you can do same as the example which is in the link above (creating Labels and adding them to each PickerRow): 如果这不起作用,则可以与上面的链接中的示例相同(创建标签并将其添加到每个PickerRow):
var fruit = [ 'Bananas', 'Strawberries', 'Mangos', 'Grapes' ];
var column1 = Ti.UI.createPickerColumn();
for(var i=0, ilen=fruit.length; i<ilen; i++){
var row = Ti.UI.createPickerRow();
var label = Ti.UI.createLabel({
color:'red',
font:{fontSize:20,fontWeight:'bold'},
text: fruit[i],
textAlign:'left',
width:'126'
});
row.add(label);
column1.addRow(row);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.