Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8470] Android: Picker in scrollView not working

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-04-24T08:28:12.000+0000
Affected Version/sRelease 1.8.2
Fix Version/sRelease 2.1.0, Sprint 2012-08
ComponentsAndroid
Labelsapi, module_picker, qe-testadded
ReporterChristian Brousseau
AssigneeHieu Pham
Created2012-03-31T20:18:49.000+0000
Updated2012-07-12T15:17:54.000+0000

Description

Issue

Picker in scrollView not working.

Tested on

Android Emulator 2.2 Droid Razr 2.3.5

Runtime Engines

Rhino / V8

Steps to reproduce

1. Run code below 2. Click the picker

Expected behavior

See fully operational Pickers whose options render on screen

Repro sequence

Titanium.UI.setBackgroundColor('#000');
  
var win1 = Titanium.UI.createWindow({ 
    title:'Tab 1',
    backgroundColor:'#fff'
});
  
var win5 = Titanium.UI.createScrollView({
    contentHeight:'auto',
    left:15,
    right:5
    ,layout:'vertical'
});
  
  
var names = ['Joanie', 'Mickey', 'Jean-Pierre', 'Gustav', 'Raul', 'Mimi', 'Emily', 'Sandra', 'Carrie', 'Chachi'];
var verbs = ['loves', 'likes', 'visits', 'loathes', 'waves to', 'babysits', 'accompanies', 'teaches', 'announces', 'supports', 'knows', 'high-fives'];
  
var rows1 = [];
for (var i = 0; i < names.length; i++) {
    rows1.push(Ti.UI.createPickerRow({title: names[i]}));
}
  
var rows2 = [];
for (i = 0; i < verbs.length; i++) {
    rows2.push(Ti.UI.createPickerRow({title: verbs[i]}));
}
  
var rows3 = [];
for (i = (names.length -1); i >=0; i--) {
    rows3.push(Ti.UI.createPickerRow({title: names[i]}));
}
  
var column1 = Ti.UI.createPickerColumn( {
    rows: rows1, font: {fontSize: "12"}
});
var column2 = Ti.UI.createPickerColumn( {
    rows: rows2, font: {fontSize: "12"}
});
var column3 = Ti.UI.createPickerColumn( {
    rows: rows3, font: {fontSize: "12"}
});
  
var picker = Ti.UI.createPicker({
    useSpinner: true, visibleItems: 7,
    type : Ti.UI.PICKER_TYPE_PLAIN,
    top: 20, height: '200',
    columns: [ column1, column2, column3 ]
});
  
picker.addEventListener('change', function(e) {
    Ti.API.info(e.selectedValue[0] + " " + e.selectedValue[1] + " " + e.selectedValue[2]);
});
  
win5.add(picker);
win1.add(win5);
  
win1.open();

Comments

  1. Tim Poulsen 2012-04-06

    Still not working in 2.0.0.GA. Drop the following into a standard new project. Picker shows up, but clicking does not display its options dialog box. The spinner style picker works fine.
       var sv = Ti.UI.createScrollableView();
       var v1 = Ti.UI.createView({
       	backgroundColor: 'red'
       });
       var v2 = Ti.UI.createView({
       	backgroundColor: 'blue'
       });
       var v3 = Ti.UI.createView({
       	backgroundColor: 'green'
       });
       
       
       var picker = Ti.UI.createPicker();
       
       var data = [];
       data[0]=Ti.UI.createPickerRow({title:'Bananas',custom_item:'b'});
       data[1]=Ti.UI.createPickerRow({title:'Strawberries',custom_item:'s'});
       data[2]=Ti.UI.createPickerRow({title:'Mangos',custom_item:'m'});
       data[3]=Ti.UI.createPickerRow({title:'Grapes',custom_item:'g'});
       
       // turn on the selection indicator (off by default)
       picker.selectionIndicator = true;
       picker.add(data)
       v1.add(picker)
       sv.views = [v1, v2, v3]
       win1.add(sv)
       
  2. Hieu Pham 2012-04-19

    A PR with the workaround - increase scrollview sensitivity, is pending. The issue is that we're not getting touch events in certain area of the picker when it is put inside the scrollview. This could be a deep layout bug or a bug in WheelView's implementation. A deeper analysis will be looked at later.
  3. Vishal Duggal 2012-04-24

    Fixed by PR 2043
  4. Smitha Guduru 2012-06-23

    Picker in scrollView is working. Verified on Titanium Studio, build: 2.2.0.201206222035 Titanium SDK: 2.1.0.v20120622174154 Device:Xoom(4.0.3)

JSON Source