Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10045] Android: Scaling Picker with 2DMatrix

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 2.0.2
Fix Version/sn/a
ComponentsAndroid
Labelsapi
ReporterReto Vollenweider
AssigneeUnknown
Created2012-06-14T01:18:29.000+0000
Updated2018-02-28T20:04:23.000+0000

Description

Problem

In the docs, it is not stated that we support the "transform" property of a picker type view. Though when you set the property, the picker does scale to the desired size. On iphone, this method works without a hitch. On android however, only when you scale larger than the default picker size, the pixels seem to be stuck at the bottom and the words stick to the picker as the options are scrolled through (see attached picture).

Desired Result

The picker should scale correctly without leaving static pixels when scrolled through. This behavior should also be added to the docs to show that we support this method of resizing the picker.
var fruit = ['Bananas', 'Grapes', 'Blueberries', 'Strawberries', 'Bananas', 'Grapes', 'Blueberries', 'Strawberries'];
var color = ['blue', 'red', 'yellow', 'white', 'blue', 'red', 'yellow', 'white'];
 
var column1 = Ti.UI.createPickerColumn();
for (var i = 0, ilen = fruit.length; i < ilen; i++) {
    var row = Ti.UI.createPickerRow({
        title : fruit[i]
    });
    column1.addRow(row);
}
 
var column2 = Ti.UI.createPickerColumn();
for (var i = 0, ilen = color.length; i < ilen; i++) {
    var row = Ti.UI.createPickerRow({
        title : color[i]
    });
    column2.addRow(row);
}
 
var t = Ti.UI.create2DMatrix();
t = t.scale(1.3);
var picker = Ti.UI.createPicker({
    selectionIndicator : true,
    useSpinner : true,
    visibleItems : 7,
    transform : t
});
picker.add(column1);
picker.add(column2);
 
var win = Ti.UI.createWindow({
    backgroundColor : 'white',
    exitOnClose : true,
    fullscreen : false,
    title : 'Use picker to make selection'
});
win.add(picker);
win.open();

Steps to Reproduce

1. Copy and paste the code above into Titanium Studio 2. Run the code on android emulator or device 3. Take note of stuck pixels at bottom of picker 4. Run code on iPhone simulator to see desired effect 5. Change scale factor to .7 (anything below 1 will be fine) and observe correct behavior on both android and iOS

Attachments

FileDateSize
bug.png2012-06-14T01:18:29.000+0000182950

Comments

  1. Carter Lathrop 2012-07-19

    Reto, I have tested this code and have reported this as a new feature request, rather than a bug. The reason for this, if you look in the docs, we do not currently support scaling the size of the picker using the transform property. Thank you for bringing this to our attention. Please keep a watch on the bug, as will I and I will be sure to follow up when the this feature is added. Regards, Carter

JSON Source