[AC-5379] Can't change picker font on Android (PickerRow.setFont undefined)
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-11-22T19:59:40.000+0000 |
| Affected Version/s | Appcelerator Studio 4.5.0 |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | Android, PickerRow, font, setFont |
| Reporter | carlo |
| Assignee | Shak Hossain |
| Created | 2017-11-16T13:02:38.000+0000 |
| Updated | 2017-11-22T19:59:40.000+0000 |
Description
PickerRow setFont is undefined on Android, setting "font" property has no effect.
test code:
var win = Ti.UI.createWindow();
var picker = Ti.UI.createPicker({});
var color = [ 'red', 'green', 'blue', 'orange' ];
var column1 = Ti.UI.createPickerColumn();
Ti.API.info(column1.setFont);//undefined on Android
column1.font = {fontSize:50};//don't work
for(var i=0, ilen=color.length; i<ilen; i++){
var row = Ti.UI.createPickerRow({
title: color[i]
});
//row.font = {fontSize:50};//works on iOS
column1.addRow(row);
}
picker.add([column1]);
Ti.API.info(picker.columns[0].setFont);//undefined on Android
win.add(picker);
win.open();
Ti.API.info(column1.setFont);//undefined on Android
Hello, Can you describe the issue a little more in here? I don't see any error as "undefined" in the console when I change the picker value. Thanks.
You don't need to change value Using:
orcolumn1.setFont({fontSize:50});should change the font size but isn't working because (you can see in log during window construction) the function for changing font (column1.setFont) is undefinedcolumn1.font = {fontSize:50};Hello [~c3k], Thanks for your feedback. Can you please try the following sample code below? This can be a workaround to change picker font on Android.
*Console logs:*var win = Ti.UI.createWindow(); var picker = Ti.UI.createPicker({}); picker.font= { fontSize: 10, }; var color = [ 'red', 'green', 'blue', 'orange' ]; var column1 = Ti.UI.createPickerColumn({}); Ti.API.info('Picket font is '+picker.font.fontSize);//undefined on Android for(var i=0, ilen=color.length; i<ilen; i++){ var row = Ti.UI.createPickerRow({ title: color[i] }); column1.addRow(row); } picker.add([column1]); Ti.API.info('setFont is '+picker.font.fontSize); win.open();Hope this helps. Bestyes, it works, need to update the docs...: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Picker-property-font *Only applicable* to Titanium.UI.PICKER_TYPE_DATE and Titanium.UI.PICKER_TYPE_TIME picker types for android. *For Titanium.UI.PICKER_TYPE_PLAIN, refer to* Titanium.UI.PickerColumn for android, and Titanium.UI.PickerRow for iphone / ipad.
Hello, Thanks for letting us know.