Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16485] Android:contentWidth in scrollview not working properly when setting layout to horizontal for android

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-04-17T22:28:48.000+0000
Affected Version/sRelease 3.2.0, Release 3.2.1
Fix Version/s2014 Sprint 08, 2014 Sprint 08 SDK, Release 3.3.0
ComponentsAndroid
Labelsmodule_scrollview, qe-closed-3.3.0, qe-testadded, supportTeam
ReporterRupesh Sharma
AssigneeHieu Pham
Created2014-02-20T08:27:07.000+0000
Updated2014-06-19T12:43:08.000+0000

Description

Description

When using a scrollview and setting layout to 'horizontal', I wish to scroll the content in a horizontal fashion, Setting contentWidth to Ti.UI.SIZE or Ti.UI.FILL or auto doesn't work unless I specify the specific contentWidth. This used to work properly in previous version sdk 3.1.3.GA

Test Case

var win = Ti.UI.createWindow({
  backgroundColor:'white'
});


function createRow(i) {
  var row = Ti.UI.createView({
    backgroundColor: 'white',
    borderColor: '#bbb',
    borderWidth: 1,
    width:40, height: 40,
    top: 0, left: 4
  });
  return row;
}

var scrollView = Ti.UI.createScrollView({
  bottom:120,
  layout: 'horizontal',
  contentWidth:'auto',
  contentHeight:50,
  height:50
});

for(var i = 0; i <= 20; i++){
var row = createRow(i);
  scrollView.add(row);
}
win.add(scrollView);

win.open();
Expected Behaviour : It should allow to scroll horizontally Actual Behaviour : Its not allowing to scroll horizontally Note : If I set any specific contentWidth (any specific value) then it will allow me to scroll.

Comments

  1. Hieu Pham 2014-04-17

    Another test case:
       var win = Ti.UI.createWindow({
         backgroundColor:'white'
       });
        
        
       function createRow(i) {
         var row = Ti.UI.createView({
           backgroundColor: 'white',
           borderColor: '#bbb',
           borderWidth: 1,
           width:200, height: 40,
           top: 0, left: 4, bottom: 4
         });
         return row;
       }
        
       var scrollView = Ti.UI.createScrollView({
         bottom:120,
         layout: 'horizontal',
         scrollType: 'horizontal',
         contentWidth: 'auto',
         horizontalWrap: true,
         height: Ti.UI.SIZE,
         width: 200,
         backgroundColor:'red'
       });
        
       for(var i = 0; i < 5; i++){
       var row = createRow(i);
         scrollView.add(row);
       }
       win.add(scrollView);
        
       win.open();
       
  2. Vishal Duggal 2014-04-17

    PR https://github.com/appcelerator/titanium_mobile/pull/5601 merged into master
  3. Olga Romero 2014-04-22

    Tested and verified the ability to scroll content in scrollview. Titanium SDK, build 3.3.0.v20140418162516 Node.JS Version: v0.10.13 NPM Version: 1.3.2 ├── acs@1.0.14 ├── alloy@1.3.1 ├── node-appc@0.2.0 ├── npm@1.3.2 ├── titanium@3.3.0-dev └── titanium-code-processor@1.1.1-beta1 npm -g ls titanium: /usr/local/lib └── titanium@3.3.0-dev (git://github.com/appcelerator/titanium.git#93414d143051df4578b7aa42670008e5ef02c422) XCode Version: 5.1.1 Devices: Nexus 4 Android version 4.4 iPhone 5S iOS 7.0

JSON Source