Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5379] Can't change picker font on Android (PickerRow.setFont undefined)

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionFixed
Resolution Date2017-11-22T19:59:40.000+0000
Affected Version/sAppcelerator Studio 4.5.0
Fix Version/sn/a
ComponentsTitanium SDK & CLI
LabelsAndroid, PickerRow, font, setFont
Reportercarlo
AssigneeShak Hossain
Created2017-11-16T13:02:38.000+0000
Updated2017-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

Comments

  1. Sharif AbuDarda 2017-11-17

    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.
  2. carlo 2017-11-20

    You don't need to change value Using:
       column1.setFont({fontSize:50});
       
    or
       column1.font = {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 undefined
  3. Mostafizur Rahman 2017-11-22

    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.
       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();
       
       
    *Console logs:*
       [INFO] :   Picket font is 10
       [INFO] :   setFont is 10
       [INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.hthworldwide.sampleCam.SamplecameraappActivity@44e053c
       [INFO] :   HwSecImmHelper: mSecurityInputMethodService is null
       [INFO] :   HwPointEventFilter: do not support AFT because of no config
       
    Hope this helps. Best
  4. carlo 2017-11-22

    yes, 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.
  5. Sharif AbuDarda 2017-11-22

    Hello, Thanks for letting us know.

JSON Source