Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9955] Android: ScrollView with a wrap view becomes unscrollable on android Ti 2.1

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2013-04-01T17:47:29.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sSprint 2012-15 Core
ComponentsAndroid
Labelscore, module_scrollview, parity, qe-review, qe-testadded
ReporterNikhil Sharma
AssigneeAllen Yeung
Created2012-07-12T14:04:59.000+0000
Updated2013-04-02T07:07:57.000+0000

Description

ScrollView with a wrap view becomes unscrollable on android Ti SDK 2.1.0.GA. It works on Ti SDK 2.0.1.GA2. It works fine on iOS.

Repo Steps

1. Run the below code in your app.js 2. You can see the scrollView becomes unscrollable.
var win = Ti.UI.createWindow({
        backgroundColor : 'white'
    }); 
var scrollView = Ti.UI.createScrollView({
    top : 44,
    left : 0,
    right : 0,
    bottom : 0,
    showVerticalScrollIndicator : true,
    showHorizontalScrollIndicator : true,
    canCancelEvents : false,
    zIndex : 10
});
 
var view = Ti.UI.createView({
	backgroundColor:'blue',
    left : "4%",
    right : "4%",
    layout: 'vertical',
    top : 0
});
 
for (var i = 0; i < 20; i++) {
    var v = Ti.UI.createLabel({
    	backgroundColor: 'green',
        height : 50,
        top : 50,
        text : i
    });
    view.add(v);
};

contentHeight = 2050;
scrollView.contentHeight = view.height = contentHeight;
 
scrollView.add(view);
win.add(scrollView);
win.open();

Comments

  1. Max Stepanov 2012-07-13

    The test example attached above works as expected. Setting "canCancelEvents: false" limits scroll touch area to 4% from left/right borders.
  2. Allen Yeung 2012-07-24

    PR Ready: https://github.com/appcelerator/titanium_mobile/pull/2634
  3. Allen Yeung 2012-07-25

    More detailed test steps: 1. Launch the app.js above 2. Long press either the blue background, or a green label, and then scroll up and down with the same press. (the view should not scroll) 3. Try to scroll inside blue background without a long press, and it should scroll. This behavior should match iOS.
  4. Rima Umbrasas 2012-08-10

    Verified fixed with mobile sdk-2.2.0.v20120810080115 Titanium Studio, build: 2.1.1.201207271312
  5. Shyam Bhadauria 2012-08-21

    Occurs on: Titanium SDK: 2.1.2.v20120816171609 Titanium  Studio: 2.1.2.201208192014 Device: Samsung GALAXY Note (2.3.6) Fixed with: SDK version: 2.2.0.v20120810080115
  6. Allen Yeung 2012-12-07

    I have reverted the fix for this in https://github.com/appcelerator/titanium_mobile/pull/3558. For android, we actually block all events from any subview to the scroll view and it's the closest we can get to the iOS implementation since it just maps to a native property. I have documented that there may be a difference between iOS and Android in the docs in this PR. If you want the blue view to scroll for this test case, I would recommend not setting the 'canCancelEvents' property to false.
  7. Shyam Bhadauria 2013-01-14

    Scrollview is now scrollable. Verified with following env. Titanium SDK: 3.0.0.GA Titanium  Studio:3.0.1.201212181159 Device: LG-P970 Android 2.2.2
  8. Paras Mishra 2013-04-01

    ScrollView in not scrollable. Tested on: Device : Google Nexus 7, Android Version: 4.1 SDK: 3.1.0.v20130331073351 CLI version : 3.0.25-alpha OS : MAC OSX 10.7.5
  9. Allen Yeung 2013-04-01

    Please read the comments before reopening. As I mentioned, it SHOULD be unscrollable if you specify 'canCancelEvents' to false. The docs have also been updated to reflect this.
  10. Paras Mishra 2013-04-02

    working as expected, Hence closing it.

JSON Source