[TIMOB-9802] Android: ScrollView - ScrollView scrolls horizontally when manually set to vertical layout
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 2.1.0 |
Fix Version/s | n/a |
Components | Android |
Labels | core, qe-and060112, reprod |
Reporter | Shyam Bhadauria |
Assignee | Unknown |
Created | 2012-06-26T05:12:24.000+0000 |
Updated | 2018-02-28T20:03:29.000+0000 |
Description
This is a regression.Was not occuring in 2.0.2.
Details:
If the scrollView.width and scrollView.height are manually set to a vertical layout i.e. do not use the layout property, vertical scrollView will not scroll.
Steps to reproduce:
1. Launch code in app.js:
var win = Titanium.UI.createWindow({
layout:'vertical',
backgroundColor:'#fff'
});
var scrollView = Ti.UI.createScrollView({
showHorizontalScrollIndicator:true, showVerticalScrollIndicator:true,
width: 250, height: 100, top: 50,
borderColor:'green', borderWidth:1,
contentWidth:1000, contentHeight:100
});
for(var i=0; i<10; i++) {
for(var j=0; j<10; j++) {
scrollView.add(Ti.UI.createLabel({
top:i*100, left:j*100,
width:100, height:100,
text:i+':'+j, textAlign:'center',
color:'white',
backgroundColor:'#A0' + Number(i%2*8).toString(16) +'0'+ Number(8-j%2*8).toString(16)+'0',
borderColor:'black', borderWidth:1
}));
}
}
var button = Ti.UI.createButton({title:'Flip', width:100, height:50});
button.addEventListener('click', function() {
// bug is here
scrollView.width = 100;
scrollView.height = 250;
scrollView.contentWidth = 100;
scrollView.contentHeight = 1000;
button.title = 'Click again';
});
scrollView.addEventListener('scroll', function() {
//Ti.API.info('Offset: (' + scrollView.contentOffset.x + ', ' + scrollView.contentOffset.y + ')');
});
win.add(scrollView);
win.add(button);
win.open();
2. Press Flip
3. Try scrolling
Actual: ScrollView will not scroll vertically, but is will scroll horizontally.
Expected: Should be able to scroll vertically and not horizontally.
Titanium Studio: 2.1.0.201206251749 Mobile SDK: 2.1.0.v20120626074155 OS: X Lion Device: Android Emulator, Samsung Nexus S. Reproducible Unable to scroll vertically.
I tried 2.0.2 and 2.0.1, and I was not able to scroll vertically on older versions either.
My notes: tried this without the vertical layout property, this caused no change in behavior, so not a factor. Tried this test with 2.0.2 on Droid 3 and Galaxy Tab 10.1. The result was that after the "flip" button is clicked, the scrollview could not scroll either horizontal or vertical. This shows that this is not a regression.
According to Max, Android allows only one scroll direction.
I am able to reproduce this issue with the following environment; Pixel (7.1) Studio 4.9.0.201705302345 Ti SDK 6.1.1 GA Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131